home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-10-05 | 76.0 KB | 2,658 lines |
- Newsgroups: comp.sources.misc
- X-UNIX-From: eln272v@monu1.cc.monash.edu.au
- from: Russell Lang <rjl@monu1.cc.monash.edu.au>
- subject: v15i019: gnuplot 2.0 patch 1 (4 of 4)
- Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
-
- Posting-number: Volume 15, Issue 19
- Submitted-by: Russell Lang <rjl@monu1.cc.monash.edu.au>
- Archive-name: gnuplot2/patch04
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of shell archive."
- # Contents: patch1c
- # Wrapped by eln272v@monu1 on Tue Sep 18 14:53:08 1990
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f patch1c -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"patch1c\"
- else
- echo shar: Extracting \"patch1c\" \(73914 characters\)
- sed "s/^X//" >patch1c <<'END_OF_patch1c'
- Xdiff -c ./term/eepic.trm ../patch/term/eepic.trm
- X*** ./term/eepic.trm Tue Mar 27 09:03:33 1990
- X--- ../patch/term/eepic.trm Wed Sep 12 09:38:06 1990
- X***************
- X*** 44,51
- X #define EEPIC_UNIT (EEPIC_PTS_PER_INCH/DOTS_PER_INCH) /* dot size in pt */
- X
- X /* 5 inches wide by 3 inches high (default) */
- X! #define EEPIC_XMAX (unsigned int)(EEPIC_PTS_PER_INCH/EEPIC_UNIT*5.0)
- X! #define EEPIC_YMAX (unsigned int)(EEPIC_PTS_PER_INCH/EEPIC_UNIT*3.0)
- X
- X #define EEPIC_HTIC (5./EEPIC_UNIT)
- X #define EEPIC_VTIC (5./EEPIC_UNIT)
- X
- X--- 44,51 -----
- X #define EEPIC_UNIT (EEPIC_PTS_PER_INCH/DOTS_PER_INCH) /* dot size in pt */
- X
- X /* 5 inches wide by 3 inches high (default) */
- X! #define EEPIC_XMAX (5*DOTS_PER_INCH) /* (EEPIC_PTS_PER_INCH/EEPIC_UNIT*5.0) */
- X! #define EEPIC_YMAX (3*DOTS_PER_INCH) /* (EEPIC_PTS_PER_INCH/EEPIC_UNIT*3.0) */
- X
- X #define EEPIC_HTIC (5*DOTS_PER_INCH/72) /* (5./EEPIC_UNIT) */
- X #define EEPIC_VTIC (5*DOTS_PER_INCH/72) /* (5./EEPIC_UNIT) */
- X***************
- X*** 47,56
- X #define EEPIC_XMAX (unsigned int)(EEPIC_PTS_PER_INCH/EEPIC_UNIT*5.0)
- X #define EEPIC_YMAX (unsigned int)(EEPIC_PTS_PER_INCH/EEPIC_UNIT*3.0)
- X
- X! #define EEPIC_HTIC (5./EEPIC_UNIT)
- X! #define EEPIC_VTIC (5./EEPIC_UNIT)
- X! #define EEPIC_HCHAR (5.3/EEPIC_UNIT)
- X! #define EEPIC_VCHAR (11./EEPIC_UNIT)
- X
- X static unsigned int EEPIC_posx;
- X static unsigned int EEPIC_posy;
- X
- X--- 47,56 -----
- X #define EEPIC_XMAX (5*DOTS_PER_INCH) /* (EEPIC_PTS_PER_INCH/EEPIC_UNIT*5.0) */
- X #define EEPIC_YMAX (3*DOTS_PER_INCH) /* (EEPIC_PTS_PER_INCH/EEPIC_UNIT*3.0) */
- X
- X! #define EEPIC_HTIC (5*DOTS_PER_INCH/72) /* (5./EEPIC_UNIT) */
- X! #define EEPIC_VTIC (5*DOTS_PER_INCH/72) /* (5./EEPIC_UNIT) */
- X! #define EEPIC_HCHAR (DOTS_PER_INCH*53/10/72) /* (5.3/EEPIC_UNIT) */
- X! #define EEPIC_VCHAR (DOTS_PER_INCH*11/72) /* (11./EEPIC_UNIT) */
- X
- X static unsigned int EEPIC_posx;
- X static unsigned int EEPIC_posy;
- X***************
- X*** 92,97
- X static int EEPIC_type; /* current line type */
- X static BOOLEAN EEPIC_inline = FALSE; /* are we in the middle of a line */
- X static void EEPIC_endline(); /* terminate any line in progress */
- X
- X /* ARROWS */
- X /* we use the same code as for LATEX */
- X
- X--- 92,99 -----
- X static int EEPIC_type; /* current line type */
- X static BOOLEAN EEPIC_inline = FALSE; /* are we in the middle of a line */
- X static void EEPIC_endline(); /* terminate any line in progress */
- X+ static int EEPIC_linecount = 0; /* number of points in line so far */
- X+ #define EEPIC_LINEMAX 50 /* max value for linecount */
- X
- X /* ARROWS */
- X /* we use the same code as for LATEX */
- X***************
- X*** 181,186
- X fprintf(outfile, "%s(%u,%u)",
- X EEPIC_lines[EEPIC_type+2],
- X EEPIC_posx, EEPIC_posy);
- X }
- X
- X /* add new point to line */
- X
- X--- 183,201 -----
- X fprintf(outfile, "%s(%u,%u)",
- X EEPIC_lines[EEPIC_type+2],
- X EEPIC_posx, EEPIC_posy);
- X+ EEPIC_linecount = 1;
- X+ } else {
- X+ /* Even though we are in middle of a path,
- X+ * we may want to start a new path command.
- X+ * If they are too long then latex will choke.
- X+ */
- X+ if (EEPIC_linecount++ >= EEPIC_LINEMAX) {
- X+ fprintf(outfile, "\n");
- X+ fprintf(outfile, "%s(%u,%u)",
- X+ EEPIC_lines[EEPIC_type+2],
- X+ EEPIC_posx, EEPIC_posy);
- X+ EEPIC_linecount = 1;
- X+ }
- X }
- X fprintf(outfile, "(%u,%u)", ux,uy);
- X EEPIC_posx = ux;
- X***************
- X*** 182,189
- X EEPIC_lines[EEPIC_type+2],
- X EEPIC_posx, EEPIC_posy);
- X }
- X-
- X- /* add new point to line */
- X fprintf(outfile, "(%u,%u)", ux,uy);
- X EEPIC_posx = ux;
- X EEPIC_posy = uy;
- X
- X--- 197,202 -----
- X EEPIC_linecount = 1;
- X }
- X }
- X fprintf(outfile, "(%u,%u)", ux,uy);
- X EEPIC_posx = ux;
- X EEPIC_posy = uy;
- Xdiff -c ./term/eps60.trm ../patch/term/eps60.trm
- X*** ./term/eps60.trm Mon Sep 3 16:07:23 1990
- X--- ../patch/term/eps60.trm Mon Sep 3 15:54:14 1990
- X***************
- X*** 0
- X
- X--- 1,106 -----
- X+ #ifdef EPS60
- X+
- X+ /* make the total dimensions 8 inches by 5 inches */
- X+ #define EPS60XMAX 480
- X+ #define EPS60YMAX 360
- X+
- X+ #define EPS60XLAST (EPS60XMAX - 1)
- X+ #define EPS60YLAST (EPS60YMAX - 1)
- X+
- X+ EPS60init()
- X+ {
- X+ char filename[MAX_ID_LEN+1];
- X+ bm_xmax=EPS60XMAX;
- X+ bm_ymax=EPS60YMAX;
- X+ bm_planes=1; /* one plane */
- X+ bm_value=1;
- X+ bm_setup();
- X+ /* output for EPSON must be binary to stop non Unix computers
- X+ changing \n to \r\n.
- X+ At present we only do this for PC's.
- X+ (Ultrix generates a run time error on the "wb" mode).
- X+ if the output is not STDOUT, then the following code
- X+ reopens outfile with binary mode. */
- X+ #ifdef PC
- X+ if (strcmp(outstr,"STDOUT")) {
- X+ (void) fclose(outfile);
- X+ (void) strcpy(filename,outstr+1); /* remove quotes */
- X+ filename[strlen(filename)-1] = '\0';
- X+ if ( (outfile = fopen(filename,"wb")) == (FILE *)NULL ) {
- X+ if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
- X+ os_error("cannot reopen file with binary type; output unknown",
- X+ NO_CARET);
- X+ }
- X+ else {
- X+ os_error("cannot reopen file with binary type; output reset to ascii",
- X+ NO_CARET);
- X+ }
- X+ }
- X+ }
- X+ #endif
- X+ }
- X+
- X+
- X+ /* output file must be binary mode for eps60_dump */
- X+ eps60_dump()
- X+ {
- X+ unsigned int x;
- X+ int j,k;
- X+ int num_bits = (sizeof(unsigned int)-1)*8;
- X+ #ifdef PC
- X+ fprintf(stderr,"Dumping Epson-style 60-dpi graphics (21kbytes)\n");
- X+ #endif
- X+ fprintf(outfile,"\0333\030"); /* set line spacing to 24/216" = 8 dots */
- X+ for (j=bm_ipc-1;j>=0;j--) {
- X+ for (k=num_bits;k>=0;k-=8) {
- X+ /* select printer graphics mode 'K' */
- X+ fprintf(outfile,"\r\n\033K");
- X+ (void) fputc((char)(bm_xmax%256),outfile);
- X+ (void) fputc((char)(bm_xmax/256),outfile);
- X+ for (x=0; x<bm_xmax; x++) {
- X+ (void) fputc( (char)((bm_array[x*bm_ipc+j] >>k) &0xff), outfile );
- X+ }
- X+ }
- X+ }
- X+ fprintf(outfile,"\0333\044\r\n"); /* set line spacing to 36/216" = 1/6" */
- X+ #ifdef PC
- X+ fprintf(stderr,"Print using: COPY /B\n");
- X+ #endif
- X+ }
- X+
- X+
- X+ EPS60text()
- X+ {
- X+ eps60_dump();
- X+ }
- X+
- X+
- X+ #endif /* EPS60 */
- X+
- X+
- X+
- X+
- X+ #ifdef TANDY60
- X+
- X+ /* The only difference between TANDY60 and EPS60 is the inclusion
- X+ of codes to swap the Tandy printer into IBM mode and back
- X+ into Tandy mode. For a Tandy already in IBM mode, use EPS60. */
- X+
- X+
- X+ TANDY60text()
- X+ {
- X+ #ifdef PC
- X+ fprintf(stderr, "Inserting Tandy/IBM mode conversion codes\n");
- X+ #endif
- X+ /* Switch to IBM mode, and leave 3 inches above the plot so as
- X+ to get rough vertical centring on the page. Perform the
- X+ centring by setting 1" line feeds and issuing 3 of them. */
- X+ fprintf(outfile, "\033!\0333%c\n\n\n", 216);
- X+ eps60_dump();
- X+ /* A form feed must be sent before switching back to Tandy mode,
- X+ or else the form setting will be messed up. */
- X+ fprintf(outfile, "\f\033!");
- X+ }
- X+
- X+
- X+ #endif /* TANDY60 */
- Xdiff -c ./term/epson.trm ../patch/term/epson.trm
- X*** ./term/epson.trm Tue Mar 27 09:02:27 1990
- X--- ../patch/term/epson.trm Wed Aug 29 10:04:57 1990
- X***************
- X*** 696,698
- X
- X #endif /* NEC */
- X
- X
- X--- 696,890 -----
- X
- X #endif /* NEC */
- X
- X+ /* The following Star color driver uses generic bit mapped graphics
- X+ routines to build up a bit map in memory. */
- X+ /* Core from Epson driver by Russell Lang, eln272v@monu1.cc.monash.oz */
- X+ /* Star Color changes made by William Wilson, wew@naucse.cse.nau.edu */
- X+ /* On PC, print using 'copy file /b lpt1:', do NOT use 'print' */
- X+ /* STARC_init changes outfile to binary mode on PC's */
- X+
- X+ #ifdef STARC
- X+ #ifndef EPSON
- X+ #define EPSON
- X+ #endif
- X+
- X+ /* EPSON must be defined */
- X+
- X+ #define STARCXMAX 400
- X+ #define STARCYMAX 320
- X+
- X+ #define STARCXLAST (STARCXMAX - 1)
- X+ #define STARCYLAST (STARCYMAX - 1)
- X+
- X+ #define STARCVCHAR 11
- X+ #define STARCHCHAR 7
- X+ #define STARCVTIC 6
- X+ #define STARCHTIC 6
- X+
- X+ /* plane 0=black, 1=cyan(blue), 2=magenta(red), 3=yellow */
- X+ static unsigned int STARCcolor[] = {1,8,4,2,10,12,6,14};
- X+ static unsigned int STARCpcolor[]= {0,2,1,4};
- X+ unsigned int STARC_x=0, STARC_y=0;
- X+ int STARC_angle=0;
- X+
- X+ STARCinit()
- X+ {
- X+ char filename[MAX_ID_LEN+1];
- X+ bm_planes=4;
- X+ bm_xmax=STARCXMAX;
- X+ bm_ymax=STARCYMAX;
- X+ bm_value=1; /* black */
- X+ bm_line_mask=0xffff; /* solid lines */
- X+ bm_setup();
- X+ /* output for STARC must be binary to stop non Unix computers
- X+ changing \n to \r\n.
- X+ At present we only do this for PC's.
- X+ (Ultrix generates a run time error on the "wb" mode).
- X+ if the output is not STDOUT, then the following code
- X+ reopens outfile with binary mode. */
- X+ #ifdef PC
- X+ if (strcmp(outstr,"STDOUT")) {
- X+ (void) fclose(outfile);
- X+ (void) strcpy(filename,outstr+1); /* remove quotes */
- X+ filename[strlen(filename)-1] = '\0';
- X+ if ( (outfile = fopen(filename,"wb")) == (FILE *)NULL) {
- X+ if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
- X+ os_error("cannot reopen file with binary type; output unknown",
- X+ NO_CARET);
- X+ }
- X+ else {
- X+ os_error("cannot reopen file with binary type; output reset to ascii",
- X+ NO_CARET);
- X+ }
- X+ }
- X+ }
- X+ #endif
- X+ }
- X+
- X+
- X+ STARCgraphics()
- X+ {
- X+ unsigned int plane;
- X+ unsigned int fill=0;
- X+ for (plane=0; plane<bm_planes; plane++)
- X+ bm_cls(plane,fill);
- X+ STARC_x=0;
- X+ STARC_y=0;
- X+ STARC_angle=0;
- X+ }
- X+
- X+
- X+ STARCtext()
- X+ {
- X+ STARC_dump();
- X+ }
- X+
- X+
- X+ STARClinetype(linetype)
- X+ int linetype;
- X+ {
- X+ if (linetype>=6)
- X+ linetype %= 6;
- X+ bm_value=STARCcolor[linetype+2];
- X+ }
- X+
- X+
- X+ STARCmove(x,y)
- X+ unsigned int x,y;
- X+ {
- X+ STARC_x=x;
- X+ STARC_y=y;
- X+ }
- X+
- X+
- X+ STARCvector(x,y)
- X+ unsigned int x,y;
- X+ {
- X+ bm_line(STARC_x,x,STARC_y,y);
- X+ STARC_x=x;
- X+ STARC_y=y;
- X+ }
- X+
- X+
- X+ STARCput_text(x,y,str)
- X+ unsigned int x, y;
- X+ char *str;
- X+ {
- X+ if (STARC_angle == 1)
- X+ x += STARCVCHAR/2;
- X+ else
- X+ y -= STARCVCHAR/2;
- X+ switch (STARC_angle) {
- X+ case 0:
- X+ for (; *str; ++str, x += STARCHCHAR)
- X+ bm_putc (x, y, *str, STARC_angle);
- X+ break;
- X+ case 1:
- X+ for (; *str; ++str, y += STARCHCHAR)
- X+ bm_putc (x, y, *str, STARC_angle);
- X+ break;
- X+ }
- X+ }
- X+
- X+
- X+ int STARC_text_angle(ang)
- X+ int ang;
- X+ {
- X+ STARC_angle=ang;
- X+ return TRUE;
- X+ }
- X+
- X+
- X+ STARCreset()
- X+ {
- X+ bm_release();
- X+ }
- X+
- X+
- X+ /* output file must be binary mode for STARC_dump */
- X+ STARC_dump()
- X+ {
- X+ unsigned int x;
- X+ unsigned int plane,offset;
- X+ int j,k;
- X+ int num_bits = (sizeof(unsigned int)-1)*8;
- X+ unsigned int column8;
- X+ unsigned long column24;
- X+ char column3, column2, column1;
- X+ #ifdef PC
- X+ /* if (bm_planes==4)*/
- X+ fprintf(stderr,"Dumping STAR color graphics (65 kbytes)\n");
- X+ #endif
- X+ fprintf(outfile,"\033A\010"); /* set line spacing to 8/72" = 8 dots */
- X+ for (j=bm_ipc-1;j>=0;j--) {
- X+ for (k=num_bits;k>=0;k-=8) {
- X+ fprintf(outfile,"\n");
- X+ for (plane=0; plane<bm_planes; plane++) {
- X+ offset=plane*bm_psize;
- X+ if (bm_planes>1) {
- X+ /* select colour for plane */
- X+ fprintf(outfile,"\033r");
- X+ (void) fputc((char)STARCpcolor[plane],outfile);
- X+ fprintf(outfile,"\r");
- X+ }
- X+ /* select plotter graphics mode (square pixels) */
- X+ fprintf(outfile,"\r\033*\005");
- X+ (void) fputc((char)(bm_xmax%256),outfile);
- X+ (void) fputc((char)(bm_xmax/256),outfile);
- X+ for (x=0; x<bm_xmax; x++) {
- X+ (void) fputc( (char)((bm_array[offset+x*bm_ipc+j] >>k) &0xff), outfile);
- X+ }
- X+ }
- X+ }
- X+ }
- X+ if (bm_planes > 1) {
- X+ fprintf(outfile,"\033r");
- X+ (void) fputc('\0',outfile); /* set color to black */
- X+ }
- X+ fprintf(outfile,"\033A\014\r\n"); /* setline spacing to 12/72" */
- X+ #ifdef PC
- X+ fprintf(stderr,"Print using: COPY /B\n");
- X+ #endif
- X+ }
- X+
- X+ #endif /* STARC */
- Xdiff -c ./term/hpgl.trm ../patch/term/hpgl.trm
- X*** ./term/hpgl.trm Tue Mar 27 09:02:36 1990
- X--- ../patch/term/hpgl.trm Wed Sep 12 09:10:47 1990
- X***************
- X*** 33,40
- X #define HPGL_YLAST (HPGL_XMAX - 1)
- X
- X /* HPGL_VCHAR, HPGL_HCHAR are not used */
- X! #define HPGL_VCHAR (int)(HPGL_YMAX*0.032+0.5) /* 3.2% */
- X! #define HPGL_HCHAR (int)(HPGL_XMAX*0.012+0.5) /* 1.2% */
- X #define HPGL_VTIC (HPGL_YMAX/70)
- X #define HPGL_HTIC (HPGL_YMAX/70)
- X
- X
- X--- 33,40 -----
- X #define HPGL_YLAST (HPGL_XMAX - 1)
- X
- X /* HPGL_VCHAR, HPGL_HCHAR are not used */
- X! #define HPGL_VCHAR (HPGL_YMAX/100*32/10) /* 3.2% */
- X! #define HPGL_HCHAR (HPGL_XMAX/100*12/10) /* 1.2% */
- X #define HPGL_VTIC (HPGL_YMAX/70)
- X #define HPGL_HTIC (HPGL_YMAX/70)
- X
- Xdiff -c ./term/hpljet.trm ../patch/term/hpljet.trm
- X*** ./term/hpljet.trm Tue Mar 27 09:02:43 1990
- X--- ../patch/term/hpljet.trm Tue Aug 28 21:00:50 1990
- X***************
- X*** 397,404
- X {
- X }
- X
- X! /* put_text was added by Russell Lang, eln272v@monu1.cc.monash.oz
- X! * IT IS UNTESTED
- X */
- X /* Put text "str" at pixel position x,y
- X **/
- X
- X--- 397,404 -----
- X {
- X }
- X
- X! /* put_text was added by Russell Lang, rjl@monu1.cc.monash.edu.au
- X! * Tested and repaired by Steve Wampler sbw@naucse.cse.nau.edu
- X */
- X /* Put text "str" at pixel position x,y
- X **/
- X***************
- X*** 407,413
- X char str[];
- X {
- X fprintf(outfile, "\033&a%dH\033&a%dV",
- X! HPLJET_PX2DP(x), HPLJET_PX2DP(y) );
- X fputs(str, outfile);
- X }
- X
- X
- X--- 407,415 -----
- X char str[];
- X {
- X fprintf(outfile, "\033&a%dH\033&a%dV",
- X! HPLJET_LMARG+HPLJET_PX2DP(x),
- X! HPLJET_PX2DP(HPLJETYMAX) + HPLJET_VC2DP(2) + 30 -
- X! HPLJET_PX2DP(y) );
- X fputs(str, outfile);
- X }
- X
- X***************
- X*** 411,446
- X fputs(str, outfile);
- X }
- X
- X-
- X- /*
- X- ** Put text "str" to the lower right corner of the screen.
- X- ** "row" is the row number [0:1].
- X- ** Actually in the laserjet, put the text above the upper right corner.
- X- */
- X- HPLJETlrput_text(row,str)
- X- unsigned int row;
- X- char str[];
- X- {
- X-
- X- fprintf(outfile, "\033&a%dH\033&a%dV",
- X- HPLJET_RMARG - HPLJET_HC2DP(strlen(str)), HPLJET_VC2DP(row));
- X- fputs(str, outfile);
- X- }
- X-
- X- /*
- X- ** Put text "str" to the upper left corner of the screen.
- X- ** "row" is the (serial) number of function to be plotted.
- X- ** Actually in the laserjet, put the text under the lower left corner.
- X- */
- X- HPLJETulput_text(row,str)
- X- unsigned int row;
- X- char str[];
- X- {
- X- fprintf(outfile, "\033&a%dH\033&a%dV",
- X- HPLJET_LMARG,
- X- HPLJET_VC2DP(row+3)+HPLJET_PX2DP(HPLJETYMAX));
- X- fputs(str, outfile);
- X- }
- X
- X /*
- X ** RETURN to normal mode (exit gnuplot)
- X
- X--- 413,418 -----
- X fputs(str, outfile);
- X }
- X
- X
- X /*
- X ** RETURN to normal mode (exit gnuplot)
- Xdiff -c ./term/imagen.trm ../patch/term/imagen.trm
- X*** ./term/imagen.trm Tue Mar 27 09:03:23 1990
- X--- ../patch/term/imagen.trm Wed Sep 12 09:39:37 1990
- X***************
- X*** 39,46
- X
- X #define IMAGEN_PTS_PER_INCH (300)
- X
- X! #define IMAGEN_XMAX (10.0 * IMAGEN_PTS_PER_INCH) /* 10.0 inches */
- X! #define IMAGEN_YMAX (7.5 * IMAGEN_PTS_PER_INCH) /* 7.5 inches */
- X
- X #define IMAGEN_FONTSIZE 12
- X
- X
- X--- 39,46 -----
- X
- X #define IMAGEN_PTS_PER_INCH (300)
- X
- X! #define IMAGEN_XMAX (IMAGEN_PTS_PER_INCH * 10) /* 10.0 inches */
- X! #define IMAGEN_YMAX (IMAGEN_PTS_PER_INCH * 75 / 10) /* 7.5 inches */
- X
- X #define IMAGEN_FONTSIZE 12
- X
- Xdiff -c ./term/latex.trm ../patch/term/latex.trm
- X*** ./term/latex.trm Tue Mar 27 09:03:31 1990
- X--- ../patch/term/latex.trm Wed Sep 12 09:27:09 1990
- X***************
- X*** 17,23
- X * This file is included by ../term.c.
- X *
- X * This terminal driver supports:
- X! * LaTeX pictures
- X *
- X * AUTHORS
- X * David Kotz, Russell Lang
- X
- X--- 17,24 -----
- X * This file is included by ../term.c.
- X *
- X * This terminal driver supports:
- X! * LaTeX pictures (latex).
- X! * LaTeX pictures with emTeX specials (emtex).
- X *
- X * AUTHORS
- X * David Kotz, Russell Lang
- X***************
- X*** 39,46
- X #define LATEX_UNIT (LATEX_PTS_PER_INCH/DOTS_PER_INCH) /* dot size in pt */
- X
- X /* 5 inches wide by 3 inches high (default) */
- X! #define LATEX_XMAX (unsigned int)(LATEX_PTS_PER_INCH/LATEX_UNIT*5.0)
- X! #define LATEX_YMAX (unsigned int)(LATEX_PTS_PER_INCH/LATEX_UNIT*3.0)
- X
- X #define LATEX_HTIC (5./LATEX_UNIT)
- X #define LATEX_VTIC (5./LATEX_UNIT)
- X
- X--- 40,47 -----
- X #define LATEX_UNIT (LATEX_PTS_PER_INCH/DOTS_PER_INCH) /* dot size in pt */
- X
- X /* 5 inches wide by 3 inches high (default) */
- X! #define LATEX_XMAX (5*DOTS_PER_INCH) /* (LATEX_PTS_PER_INCH/LATEX_UNIT*5.0) */
- X! #define LATEX_YMAX (3*DOTS_PER_INCH) /* (LATEX_PTS_PER_INCH/LATEX_UNIT*3.0) */
- X
- X #define LATEX_HTIC (5*DOTS_PER_INCH/72) /* (5./LATEX_UNIT) */
- X #define LATEX_VTIC (5*DOTS_PER_INCH/72) /* (5./LATEX_UNIT) */
- X***************
- X*** 42,51
- X #define LATEX_XMAX (unsigned int)(LATEX_PTS_PER_INCH/LATEX_UNIT*5.0)
- X #define LATEX_YMAX (unsigned int)(LATEX_PTS_PER_INCH/LATEX_UNIT*3.0)
- X
- X! #define LATEX_HTIC (5./LATEX_UNIT)
- X! #define LATEX_VTIC (5./LATEX_UNIT)
- X! #define LATEX_HCHAR (5.3/LATEX_UNIT)
- X! #define LATEX_VCHAR (11./LATEX_UNIT)
- X
- X static int LATEX_posx;
- X static int LATEX_posy;
- X
- X--- 43,52 -----
- X #define LATEX_XMAX (5*DOTS_PER_INCH) /* (LATEX_PTS_PER_INCH/LATEX_UNIT*5.0) */
- X #define LATEX_YMAX (3*DOTS_PER_INCH) /* (LATEX_PTS_PER_INCH/LATEX_UNIT*3.0) */
- X
- X! #define LATEX_HTIC (5*DOTS_PER_INCH/72) /* (5./LATEX_UNIT) */
- X! #define LATEX_VTIC (5*DOTS_PER_INCH/72) /* (5./LATEX_UNIT) */
- X! #define LATEX_HCHAR (DOTS_PER_INCH*53/10/72) /* (5.3/LATEX_UNIT) */
- X! #define LATEX_VCHAR (DOTS_PER_INCH*11/72) /* (11./LATEX_UNIT) */
- X
- X static int LATEX_posx;
- X static int LATEX_posy;
- X***************
- X*** 60,66
- X /* POINTS */
- X #define LATEX_POINT_TYPES 12 /* we supply more point types */
- X static char *LATEX_points[] = {
- X! "\\makebox(0,0){$\\Diamond$}",
- X "\\makebox(0,0){$+$}",
- X "\\makebox(0,0){$\\Box$}",
- X "\\makebox(0,0){$\\times$}",
- X
- X--- 61,67 -----
- X /* POINTS */
- X #define LATEX_POINT_TYPES 12 /* we supply more point types */
- X static char *LATEX_points[] = {
- X! "\\raisebox{-1.2pt}{\\makebox(0,0){$\\Diamond$}}",
- X "\\makebox(0,0){$+$}",
- X "\\raisebox{-1.2pt}{\\makebox(0,0){$\\Box$}}",
- X "\\makebox(0,0){$\\times$}",
- X***************
- X*** 62,68
- X static char *LATEX_points[] = {
- X "\\makebox(0,0){$\\Diamond$}",
- X "\\makebox(0,0){$+$}",
- X! "\\makebox(0,0){$\\Box$}",
- X "\\makebox(0,0){$\\times$}",
- X "\\makebox(0,0){$\\triangle$}",
- X "\\makebox(0,0){$\\star$}",
- X
- X--- 63,69 -----
- X static char *LATEX_points[] = {
- X "\\raisebox{-1.2pt}{\\makebox(0,0){$\\Diamond$}}",
- X "\\makebox(0,0){$+$}",
- X! "\\raisebox{-1.2pt}{\\makebox(0,0){$\\Box$}}",
- X "\\makebox(0,0){$\\times$}",
- X "\\makebox(0,0){$\\triangle$}",
- X "\\makebox(0,0){$\\star$}",
- X***************
- X*** 78,89
- X float size; /* size of dot, or thick of line in points */
- X float dotspace; /* inter-dot space in points; 0 for lines */
- X } LATEX_lines[] = {
- X! {.4, 0}, /* thin solid line */
- X! {1.0, 0}, /* thick solid line */
- X! {2.0, 0}, /* Thick solid line */
- X! {.4, 5}, /* dotted line */
- X! {.4, 10}, /* widely dotted line */
- X! {.4, 15} /* really widely dotted line */
- X };
- X /* for drawing dotted and solid lines */
- X static void LATEX_dot_line();
- X
- X--- 79,90 -----
- X float size; /* size of dot, or thick of line in points */
- X float dotspace; /* inter-dot space in points; 0 for lines */
- X } LATEX_lines[] = {
- X! {.4, 0.0}, /* thin solid line */
- X! {1.0, 0.0}, /* thick solid line */
- X! {2.0, 0.0}, /* Thick solid line */
- X! {.4, 5.0}, /* dotted line */
- X! {.4, 10.0}, /* widely dotted line */
- X! {.4, 15.0} /* really widely dotted line */
- X };
- X /* for drawing dotted and solid lines */
- X static void LATEX_dot_line();
- X***************
- X*** 93,98
- X static BOOLEAN LATEX_moved = TRUE; /* pen is up after move */
- X static float LATEX_dotsize; /* size of LATEX_DOT in units */
- X
- X /* ARROWS */
- X /* the set of non-vertical/non-horizontal LaTeX vector slopes */
- X /* except negatives - they are handled specially */
- X
- X--- 94,104 -----
- X static BOOLEAN LATEX_moved = TRUE; /* pen is up after move */
- X static float LATEX_dotsize; /* size of LATEX_DOT in units */
- X
- X+ #ifdef EMTEX
- X+ BOOLEAN emtex=FALSE; /* not currently using emtex */
- X+ static void EMTEX_solid_line();
- X+ #endif
- X+
- X /* ARROWS */
- X /* the set of non-vertical/non-horizontal LaTeX vector slopes */
- X /* except negatives - they are handled specially */
- X***************
- X*** 109,114
- X
- X LATEX_init()
- X {
- X LATEX_posx = LATEX_posy = 0;
- X LATEX_linetype(-1);
- X fprintf(outfile, "%% GNUPLOT: LaTeX picture\n");
- X
- X--- 115,123 -----
- X
- X LATEX_init()
- X {
- X+ #ifdef EMTEX
- X+ emtex = FALSE;
- X+ #endif
- X LATEX_posx = LATEX_posy = 0;
- X LATEX_linetype(-1);
- X fprintf(outfile, "%% GNUPLOT: LaTeX picture\n");
- X***************
- X*** 152,157
- X if (linetype >= LATEX_LINE_TYPES)
- X linetype %= LATEX_LINE_TYPES;
- X
- X LATEX_flushrule();
- X
- X if (linetype >= 0 &&
- X
- X--- 161,169 -----
- X if (linetype >= LATEX_LINE_TYPES)
- X linetype %= LATEX_LINE_TYPES;
- X
- X+ #ifdef EMTEX
- X+ if (!emtex)
- X+ #endif
- X LATEX_flushrule();
- X
- X if (linetype >= 0 &&
- X***************
- X*** 155,167
- X LATEX_flushrule();
- X
- X if (linetype >= 0 &&
- X! LATEX_lines[linetype].size != LATEX_lines[LATEX_type].size)
- X! /* redefine \plotpoint */
- X! fprintf(outfile, "\\sbox{\\plotpoint}{\\rule[%.3fpt]{%.3fpt}{%.3fpt}}\n",
- X! -LATEX_lines[linetype].size/2,
- X! LATEX_lines[linetype].size,
- X! LATEX_lines[linetype].size);
- X!
- X LATEX_type = linetype;
- X LATEX_dotsize = LATEX_lines[linetype].size / LATEX_UNIT;
- X LATEX_moved = TRUE; /* reset */
- X
- X--- 167,187 -----
- X LATEX_flushrule();
- X
- X if (linetype >= 0 &&
- X! (LATEX_type < 0 ||
- X! LATEX_lines[linetype].size != LATEX_lines[LATEX_type].size)) {
- X! /* redefine \plotpoint */
- X! fprintf(outfile,
- X! "\\sbox{\\plotpoint}{\\rule[%.3fpt]{%.3fpt}{%.3fpt}}%%\n",
- X! -LATEX_lines[linetype].size/2,
- X! LATEX_lines[linetype].size,
- X! LATEX_lines[linetype].size);
- X! #ifdef EMTEX
- X! if (emtex) /* change line width */
- X! fprintf(outfile, "\\special{em:linewidth %.1fpt}%%\n",
- X! LATEX_lines[linetype].size);
- X! #endif
- X! }
- X!
- X LATEX_type = linetype;
- X LATEX_dotsize
- X = ((linetype >= 0) ? LATEX_lines[linetype].size / LATEX_UNIT : 0);
- X***************
- X*** 163,169
- X LATEX_lines[linetype].size);
- X
- X LATEX_type = linetype;
- X! LATEX_dotsize = LATEX_lines[linetype].size / LATEX_UNIT;
- X LATEX_moved = TRUE; /* reset */
- X }
- X
- X
- X--- 183,190 -----
- X }
- X
- X LATEX_type = linetype;
- X! LATEX_dotsize
- X! = ((linetype >= 0) ? LATEX_lines[linetype].size / LATEX_UNIT : 0);
- X LATEX_moved = TRUE; /* reset */
- X }
- X
- X***************
- X*** 209,215
- X }
- X } else { /* drawing real curves */
- X if (LATEX_lines[LATEX_type].dotspace == 0.0)
- X! LATEX_solid_line(LATEX_posx, (int)ux, LATEX_posy, (int)uy);
- X else
- X LATEX_dot_line(LATEX_posx, (int)ux, LATEX_posy, (int)uy);
- X }
- X
- X--- 230,241 -----
- X }
- X } else { /* drawing real curves */
- X if (LATEX_lines[LATEX_type].dotspace == 0.0)
- X! #ifdef EMTEX
- X! if (emtex)
- X! EMTEX_solid_line(LATEX_posx, (int)ux, LATEX_posy, (int)uy);
- X! else
- X! #endif
- X! LATEX_solid_line(LATEX_posx, (int)ux, LATEX_posy, (int)uy);
- X else
- X LATEX_dot_line(LATEX_posx, (int)ux, LATEX_posy, (int)uy);
- X }
- X***************
- X*** 301,315
- X if (width == 0 || height == 0)
- X return; /* ignore this rule */
- X
- X- if (width < 0) {
- X- x += width;
- X- width = -width;
- X- }
- X- if (height < 0) {
- X- y += height;
- X- height = -height;
- X- }
- X-
- X if (valid && combine) {
- X /* try to combine new rule with old rule */
- X if ((int)lastx == (int)x && lastw == width) { /* vertical rule */
- X
- X--- 327,332 -----
- X if (width == 0 || height == 0)
- X return; /* ignore this rule */
- X
- X if (valid && combine) {
- X /* try to combine new rule with old rule */
- X if ((int)lastx == (int)x && lastw == width) { /* vertical rule */
- X***************
- X*** 313,320
- X if (valid && combine) {
- X /* try to combine new rule with old rule */
- X if ((int)lastx == (int)x && lastw == width) { /* vertical rule */
- X! lasth += height;
- X! return;
- X } else if ((int)lasty == (int)y && lasth == height){ /* horiz rule */
- X lastw += width;
- X return;
- X
- X--- 330,339 -----
- X if (valid && combine) {
- X /* try to combine new rule with old rule */
- X if ((int)lastx == (int)x && lastw == width) { /* vertical rule */
- X! if (lasth * height >= 0) { /* same sign */
- X! lasth += height;
- X! return;
- X! }
- X } else if ((int)lasty == (int)y && lasth == height){ /* horiz rule */
- X if (lastw * width >= 0) { /* same sign */
- X lastw += width;
- X***************
- X*** 316,323
- X lasth += height;
- X return;
- X } else if ((int)lasty == (int)y && lasth == height){ /* horiz rule */
- X! lastw += width;
- X! return;
- X }
- X /* oh well, output last and remember the new one */
- X }
- X
- X--- 335,344 -----
- X return;
- X }
- X } else if ((int)lasty == (int)y && lasth == height){ /* horiz rule */
- X! if (lastw * width >= 0) { /* same sign */
- X! lastw += width;
- X! return;
- X! }
- X }
- X /* oh well, output last and remember the new one */
- X }
- X***************
- X*** 322,336
- X /* oh well, output last and remember the new one */
- X }
- X
- X! if (valid)
- X! /* if very small use canned dot */
- X! if (lastw < LATEX_dotsize || lasth < LATEX_dotsize)
- X! fprintf(outfile, "\\put(%d,%d){%s}\n",
- X! (int)lastx, (int)lasty, LATEX_DOT);
- X! else
- X! fprintf(outfile, "\\put(%d,%d){\\rule[%.3fpt]{%.3fpt}{%.3fpt}}\n",
- X! (int)lastx, (int)lasty, -LATEX_dotsize*LATEX_UNIT/2,
- X! lastw*LATEX_UNIT, lasth*LATEX_UNIT);
- X
- X if (flush) {
- X valid = FALSE;
- X
- X--- 343,368 -----
- X /* oh well, output last and remember the new one */
- X }
- X
- X! if (valid) {
- X! /* output the rule */
- X! if (lastw < 0) {
- X! lastx += lastw;
- X! lastw = -lastw;
- X! }
- X! if (lasth < 0) {
- X! lasty += lasth;
- X! lasth = -lasth;
- X! }
- X!
- X! /* if very small use canned dot */
- X! if (lastw < LATEX_dotsize || lasth < LATEX_dotsize)
- X! fprintf(outfile, "\\put(%d,%d){%s}\n",
- X! (int)lastx, (int)lasty, LATEX_DOT);
- X! else
- X! fprintf(outfile, "\\put(%d,%d){\\rule[%.3fpt]{%.3fpt}{%.3fpt}}\n",
- X! (int)lastx, (int)lasty, -LATEX_dotsize*LATEX_UNIT/2,
- X! lastw*LATEX_UNIT, lasth*LATEX_UNIT);
- X! }
- X
- X if (flush) {
- X valid = FALSE;
- X***************
- X*** 418,424
- X int x, y; /* points near sx,sy */
- X float m; /* slope of line */
- X float arrowslope; /* slope of arrow */
- X! float minerror; /* best-case error */
- X struct vslope *slope; /* one of the slopes */
- X struct vslope *bestslope; /* the slope with min error */
- X BOOLEAN horiz; /* was it the horiz line that was best? */
- X
- X--- 450,456 -----
- X int x, y; /* points near sx,sy */
- X float m; /* slope of line */
- X float arrowslope; /* slope of arrow */
- X! float minerror = 0; /* best-case error */
- X struct vslope *slope; /* one of the slopes */
- X struct vslope *bestslope; /* the slope with min error */
- X BOOLEAN horiz; /* was it the horiz line that was best? */
- X***************
- X*** 440,445
- X * we try to find the closest-slope arrowhead.
- X */
- X bestslope = NULL;
- X m = abs((float)dy/dx); /* the slope we want */
- X for (slope = LATEX_slopes; slope->dx != 0.0; slope++) {
- X /* find the slope of the arrow */
- X
- X--- 472,478 -----
- X * we try to find the closest-slope arrowhead.
- X */
- X bestslope = NULL;
- X+ minerror = 0; /* to shut up turbo C */
- X m = abs((float)dy/dx); /* the slope we want */
- X for (slope = LATEX_slopes; slope->dx != 0.0; slope++) {
- X /* find the slope of the arrow */
- X***************
- X*** 459,465
- X abs(ex-sx));
- X else {
- X /* we draw the line the usual way, with thin lines */
- X! if (who == 1) {
- X LATEX_linetype(LATEX_THIN_LINE);
- X LATEX_solid_line(sx,ex,sy,ey);
- X }
- X
- X--- 492,499 -----
- X abs(ex-sx));
- X else {
- X /* we draw the line the usual way, with thin lines */
- X! #ifdef EMTEX
- X! if (emtex) {
- X LATEX_linetype(LATEX_THIN_LINE);
- X EMTEX_solid_line(sx,ex,sy,ey);
- X } else
- X***************
- X*** 461,468
- X /* we draw the line the usual way, with thin lines */
- X if (who == 1) {
- X LATEX_linetype(LATEX_THIN_LINE);
- X! LATEX_solid_line(sx,ex,sy,ey);
- X! }
- X #ifdef EEPIC
- X else {
- X EEPIC_move(sx,sy);
- X
- X--- 495,507 -----
- X #ifdef EMTEX
- X if (emtex) {
- X LATEX_linetype(LATEX_THIN_LINE);
- X! EMTEX_solid_line(sx,ex,sy,ey);
- X! } else
- X! #endif
- X! if (who == 1) {
- X! LATEX_linetype(LATEX_THIN_LINE);
- X! LATEX_solid_line(sx,ex,sy,ey);
- X! }
- X #ifdef EEPIC
- X else {
- X EEPIC_move(sx,sy);
- X***************
- X*** 464,473
- X LATEX_solid_line(sx,ex,sy,ey);
- X }
- X #ifdef EEPIC
- X! else {
- X! EEPIC_move(sx,sy);
- X! EEPIC_vector(ex,ey);
- X! }
- X #endif /* EEPIC */
- X /* and then draw an arrowhead (a short vector) there */
- X fprintf(outfile, "\\put(%d,%d){\\vector(%d,%d){0}}\n",
- X
- X--- 503,512 -----
- X LATEX_solid_line(sx,ex,sy,ey);
- X }
- X #ifdef EEPIC
- X! else {
- X! EEPIC_move(sx,sy);
- X! EEPIC_vector(ex,ey);
- X! }
- X #endif /* EEPIC */
- X /* and then draw an arrowhead (a short vector) there */
- X fprintf(outfile, "\\put(%d,%d){\\vector(%d,%d){0}}\n",
- X***************
- X*** 555,557
- X LATEX_posx = LATEX_posy = 0;
- X }
- X
- X
- X--- 594,638 -----
- X LATEX_posx = LATEX_posy = 0;
- X }
- X
- X+
- X+ #ifdef EMTEX
- X+
- X+ EMTEX_init()
- X+ {
- X+ emtex=TRUE;
- X+ LATEX_posx = LATEX_posy = 0;
- X+ fprintf(outfile, "%% GNUPLOT: LaTeX picture with emtex specials\n");
- X+ fprintf(outfile, "\\setlength{\\unitlength}{%fpt}\n", LATEX_UNIT);
- X+ LATEX_linetype(-1);
- X+ }
- X+
- X+
- X+ EMTEX_reset()
- X+ {
- X+ emtex=FALSE;
- X+ LATEX_posx = LATEX_posy = 0;
- X+ }
- X+
- X+
- X+ EMTEX_text()
- X+ {
- X+ fprintf(outfile, "\\end{picture}\n");
- X+ }
- X+
- X+
- X+ static void
- X+ EMTEX_solid_line(x1,x2, y1,y2)
- X+ int x1,x2, y1,y2;
- X+ {
- X+ /* emtex special solid line */
- X+ if (LATEX_moved)
- X+ fprintf(outfile, "\\put(%d,%d){\\special{em:moveto}}\n", x1, y1);
- X+ if ( (x1!=x2) || (y1!=y2) )
- X+ fprintf(outfile, "\\put(%d,%d){\\special{em:lineto}}\n", x2, y2);
- X+ LATEX_posx = x2;
- X+ LATEX_posy = y2;
- X+ LATEX_moved = FALSE;
- X+ }
- X+
- X+
- X+ #endif /* EMTEX */
- Xdiff -c ./term/pc.trm ../patch/term/pc.trm
- X*** ./term/pc.trm Tue Mar 27 09:03:04 1990
- X--- ../patch/term/pc.trm Tue Aug 28 20:52:11 1990
- X***************
- X*** 20,26
- X * Under Microsoft C
- X * cga, egabios, egalib, vgabios, hercules, corona325, att
- X * Under Turboc C
- X! * egalib, vgalib, vgamono, mcga, cga, hercules
- X *
- X * AUTHORS
- X * Colin Kelley, Thomas Williams, William Wilson, Russell Lang
- X
- X--- 20,26 -----
- X * Under Microsoft C
- X * cga, egabios, egalib, vgabios, hercules, corona325, att
- X * Under Turboc C
- X! * egalib, vgalib, vgamono, mcga, cga, hercules, att
- X *
- X * AUTHORS
- X * Colin Kelley, Thomas Williams, William Wilson, Russell Lang
- X***************
- X*** 110,116
- X pixelon = (((unsigned int)(font5x7[i][j])) >> k & 1);
- X if (pixelon) {
- X switch(angle) {
- X! case 0 : line_func(x+k+1,y-j,x+k+1,y-j);
- X break;
- X case 1 : line_func(x-j,y-k-1,x-j,y-k-1);
- X break;
- X
- X--- 110,116 -----
- X pixelon = (((unsigned int)(font5x7[i][j])) >> k & 1);
- X if (pixelon) {
- X switch(angle) {
- X! case 0 : (*line_func)(x+k+1,y-j,x+k+1,y-j);
- X break;
- X case 1 : (*line_func)(x-j,y-k-1,x-j,y-k-1);
- X break;
- X***************
- X*** 112,118
- X switch(angle) {
- X case 0 : line_func(x+k+1,y-j,x+k+1,y-j);
- X break;
- X! case 1 : line_func(x-j,y-k-1,x-j,y-k-1);
- X break;
- X }
- X }
- X
- X--- 112,118 -----
- X switch(angle) {
- X case 0 : (*line_func)(x+k+1,y-j,x+k+1,y-j);
- X break;
- X! case 1 : (*line_func)(x-j,y-k-1,x-j,y-k-1);
- X break;
- X }
- X }
- X***************
- X*** 1197,1202
- X outtextxy(x,HERC_YLAST-y,buf);
- X }
- X
- X
- X #endif /* ifndef __TURBOC__ */
- X
- X
- X--- 1197,1301 -----
- X outtextxy(x,HERC_YLAST-y,buf);
- X }
- X
- X+
- X+ #ifdef ATT6300
- X+ /* this driver added by rjl@monu1.cc.monash.edu.au */
- X+
- X+ #define ATT_XMAX 640
- X+ #define ATT_YMAX 400
- X+
- X+ #define ATT_XLAST (ATT_XMAX - 1)
- X+ #define ATT_YLAST (ATT_YMAX - 1)
- X+
- X+ #define ATT_VCHAR PC_VCHAR
- X+ #define ATT_HCHAR PC_HCHAR
- X+ #define ATT_VTIC 4
- X+ #define ATT_HTIC 5
- X+
- X+ #define ATT_text_angle PC_text_angle
- X+ #define ATT_justify_text PC_justify_text
- X+ #define ATT_reset PC_reset
- X+
- X+ ATT_init()
- X+ {
- X+ g_driver=ATT400;
- X+ g_mode=5;
- X+ initgraph(&g_driver,&g_mode,path);
- X+ switch (g_driver){
- X+ case -2: fprintf(stderr,"Graphics card not detected.\n");
- X+ break;
- X+ case -3: fprintf(stderr,"BGI driver file cannot be found.\n");
- X+ break;
- X+ case -4: fprintf(stderr,"Invalid BGI driver file.\n");
- X+ break;
- X+ case -5: fprintf(stderr,"Insufficient memory to load ",
- X+ "graphics driver.");
- X+ break;
- X+ }
- X+ }
- X+
- X+ ATT_graphics()
- X+ {
- X+ g_driver=ATT400;
- X+ g_mode=5;
- X+ initgraph(&g_driver,&g_mode,path);
- X+ ATT_justify_text(LEFT);
- X+ graphics_on = TRUE;
- X+ }
- X+
- X+ ATT_text()
- X+ {
- X+ if (graphics_on) {
- X+ graphics_on = FALSE;
- X+ pause();
- X+ }
- X+ closegraph();
- X+ }
- X+
- X+ ATT_linetype(linetype)
- X+ {
- X+ if (linetype >= 5)
- X+ linetype %= 5;
- X+ setlinestyle(4,pattern[linetype+2],1);
- X+ }
- X+
- X+ ATT_move(x,y)
- X+ {
- X+ if (x < 0)
- X+ x = 0;
- X+ else if (x > ATT_XLAST)
- X+ x = ATT_XLAST;
- X+
- X+ if (y < 0)
- X+ y = 0;
- X+ else if (y > ATT_YLAST)
- X+ y = ATT_YLAST;
- X+ moveto(x,getmaxy()-y);
- X+ }
- X+
- X+ ATT_vector(x,y)
- X+ {
- X+ if (x < 0)
- X+ x = 0;
- X+ else if (x > ATT_XLAST)
- X+ x = ATT_XLAST;
- X+ if (y < 0)
- X+ y = 0;
- X+ else if (y > ATT_YLAST)
- X+ y = ATT_YLAST;
- X+
- X+ lineto(x,getmaxy()-y);
- X+ }
- X+
- X+
- X+ ATT_put_text(x,y,str)
- X+ unsigned int x, y;
- X+ char *str;
- X+ {
- X+ strcpy((char far *)buf,str);
- X+ outtextxy(x,ATT_YLAST-y,buf);
- X+ }
- X+ #endif /* ifdef ATT6300 */
- X
- X #endif /* ifndef __TURBOC__ */
- X
- Xdiff -c ./term/post.trm ../patch/term/post.trm
- X*** ./term/post.trm Tue Mar 27 09:02:51 1990
- X--- ../patch/term/post.trm Tue Sep 18 14:40:31 1990
- X***************
- X*** 40,46
- X "/vpt2 vpt 2 mul def\n",
- X "/hpt2 hpt 2 mul def\n",
- X /* flush left show */
- X! "/Lshow { 0 vshift rmoveto show } def\n",
- X /* flush right show */
- X "/Rshow { dup stringwidth pop neg vshift rmoveto show } def\n",
- X /* centred show */
- X
- X--- 40,47 -----
- X "/vpt2 vpt 2 mul def\n",
- X "/hpt2 hpt 2 mul def\n",
- X /* flush left show */
- X! "/Lshow { currentpoint stroke moveto\n",
- X! " 0 vshift rmoveto show } def\n",
- X /* flush right show */
- X "/Rshow { currentpoint stroke moveto\n",
- X " dup stringwidth pop neg vshift rmoveto show } def\n",
- X***************
- X*** 42,48
- X /* flush left show */
- X "/Lshow { 0 vshift rmoveto show } def\n",
- X /* flush right show */
- X! "/Rshow { dup stringwidth pop neg vshift rmoveto show } def\n",
- X /* centred show */
- X "/Cshow { dup stringwidth pop -2 div vshift rmoveto show } def\n",
- X /* Border Lines */
- X
- X--- 43,50 -----
- X "/Lshow { currentpoint stroke moveto\n",
- X " 0 vshift rmoveto show } def\n",
- X /* flush right show */
- X! "/Rshow { currentpoint stroke moveto\n",
- X! " dup stringwidth pop neg vshift rmoveto show } def\n",
- X /* centred show */
- X "/Cshow { currentpoint stroke moveto\n",
- X " dup stringwidth pop -2 div vshift rmoveto show } def\n",
- X***************
- X*** 44,50
- X /* flush right show */
- X "/Rshow { dup stringwidth pop neg vshift rmoveto show } def\n",
- X /* centred show */
- X! "/Cshow { dup stringwidth pop -2 div vshift rmoveto show } def\n",
- X /* Border Lines */
- X "/BL { stroke gnulinewidth 2 mul setlinewidth} def\n",
- X /* Axes Lines */
- X
- X--- 46,53 -----
- X "/Rshow { currentpoint stroke moveto\n",
- X " dup stringwidth pop neg vshift rmoveto show } def\n",
- X /* centred show */
- X! "/Cshow { currentpoint stroke moveto\n",
- X! " dup stringwidth pop -2 div vshift rmoveto show } def\n",
- X /* Border Lines */
- X "/BL { stroke gnulinewidth 2 mul setlinewidth } def\n",
- X /* Axes Lines */
- X***************
- X*** 46,52
- X /* centred show */
- X "/Cshow { dup stringwidth pop -2 div vshift rmoveto show } def\n",
- X /* Border Lines */
- X! "/BL { stroke gnulinewidth 2 mul setlinewidth} def\n",
- X /* Axes Lines */
- X "/AL { stroke gnulinewidth 2 div setlinewidth } def\n",
- X /* Plot Lines */
- X
- X--- 49,55 -----
- X "/Cshow { currentpoint stroke moveto\n",
- X " dup stringwidth pop -2 div vshift rmoveto show } def\n",
- X /* Border Lines */
- X! "/BL { stroke gnulinewidth 2 mul setlinewidth } def\n",
- X /* Axes Lines */
- X "/AL { stroke gnulinewidth 2 div setlinewidth } def\n",
- X /* Plot Lines */
- X***************
- X*** 102,109
- X #define PS_HTIC (PS_YMAX/80)
- X
- X
- X! #define PS_SC (360.0/PS_XMAX) /* scale is 1pt = 10 units */
- X! #define PS_LW (0.25/PS_SC) /* linewidth = 0.25 pts */
- X
- X #define PS_VCHAR1 (int)(7.0/PS_SC) /* 7 point characters */
- X #define PS_HCHAR1 (int)(0.6*7.0/PS_SC)
- X
- X--- 105,112 -----
- X #define PS_HTIC (PS_YMAX/80)
- X
- X
- X! #define PS_SC (PS_XMAX/360) /* scale is 1pt = 10 units */
- X! #define PS_LW (0.25*PS_SC) /* linewidth = 0.25 pts */
- X
- X #define PS_VCHAR1 (7*PS_SC) /* 7 point characters */
- X #define PS_HCHAR1 (7*PS_SC*6/10)
- X***************
- X*** 105,112
- X #define PS_SC (360.0/PS_XMAX) /* scale is 1pt = 10 units */
- X #define PS_LW (0.25/PS_SC) /* linewidth = 0.25 pts */
- X
- X! #define PS_VCHAR1 (int)(7.0/PS_SC) /* 7 point characters */
- X! #define PS_HCHAR1 (int)(0.6*7.0/PS_SC)
- X
- X #define PS_VCHAR2 (int)(11.0/PS_SC) /* 11 point characters */
- X #define PS_HCHAR2 (int)(0.6*11.0/PS_SC)
- X
- X--- 108,115 -----
- X #define PS_SC (PS_XMAX/360) /* scale is 1pt = 10 units */
- X #define PS_LW (0.25*PS_SC) /* linewidth = 0.25 pts */
- X
- X! #define PS_VCHAR1 (7*PS_SC) /* 7 point characters */
- X! #define PS_HCHAR1 (7*PS_SC*6/10)
- X
- X #define PS_VCHAR2 (11*PS_SC) /* 11 point characters */
- X #define PS_HCHAR2 (11*PS_SC*6/10)
- X***************
- X*** 108,115
- X #define PS_VCHAR1 (int)(7.0/PS_SC) /* 7 point characters */
- X #define PS_HCHAR1 (int)(0.6*7.0/PS_SC)
- X
- X! #define PS_VCHAR2 (int)(11.0/PS_SC) /* 11 point characters */
- X! #define PS_HCHAR2 (int)(0.6*11.0/PS_SC)
- X
- X
- X EPSF1_init()
- X
- X--- 111,118 -----
- X #define PS_VCHAR1 (7*PS_SC) /* 7 point characters */
- X #define PS_HCHAR1 (7*PS_SC*6/10)
- X
- X! #define PS_VCHAR2 (11*PS_SC) /* 11 point characters */
- X! #define PS_HCHAR2 (11*PS_SC*6/10)
- X
- X
- X EPSF1_init()
- X***************
- X*** 135,142
- X fprintf(outfile,"%%%%DocumentFonts: %s\n", ps_font);
- X fprintf(outfile,"%%%%DocumentNeededFonts: %s\n", ps_font);
- X fprintf(outfile,"%%%%BoundingBox: 0 0 %d %d\n",
- X! (int)(xsize*(PS_XMAX)*PS_SC+0.5),
- X! (int)(ysize*(PS_YMAX)*PS_SC+0.5) );
- X fprintf(outfile,"%%%%EndComments\n");
- X fprintf(outfile,"40 dict begin\n");
- X fprintf(outfile,"/gnulinewidth %.3f def\n",PS_LW);
- X
- X--- 138,145 -----
- X fprintf(outfile,"%%%%DocumentFonts: %s\n", ps_font);
- X fprintf(outfile,"%%%%DocumentNeededFonts: %s\n", ps_font);
- X fprintf(outfile,"%%%%BoundingBox: 0 0 %d %d\n",
- X! (int)(xsize*(PS_XMAX)/PS_SC+0.5),
- X! (int)(ysize*(PS_YMAX)/PS_SC+0.5) );
- X fprintf(outfile,"%%%%EndComments\n");
- X fprintf(outfile,"40 dict begin\n");
- X fprintf(outfile,"/gnulinewidth %.3f def\n",PS_LW);
- X***************
- X*** 142,148
- X fprintf(outfile,"/gnulinewidth %.3f def\n",PS_LW);
- X fprintf(outfile,"/vshift %d def\n",
- X ps_big ? -PS_VCHAR2/3 : -PS_VCHAR1/3);
- X! fprintf(outfile,"/dl {%.3f mul} def\n",1/PS_SC); /* dash length */
- X fprintf(outfile,"/hpt %.1f def\n",PS_HTIC/2.0);
- X fprintf(outfile,"/vpt %.1f def\n",PS_VTIC/2.0);
- X for ( i=0; PS_header[i] != NULL; i++)
- X
- X--- 145,151 -----
- X fprintf(outfile,"/gnulinewidth %.3f def\n",PS_LW);
- X fprintf(outfile,"/vshift %d def\n",
- X ps_big ? -PS_VCHAR2/3 : -PS_VCHAR1/3);
- X! fprintf(outfile,"/dl {%d mul} def\n",PS_SC); /* dash length */
- X fprintf(outfile,"/hpt %.1f def\n",PS_HTIC/2.0);
- X fprintf(outfile,"/vpt %.1f def\n",PS_VTIC/2.0);
- X for ( i=0; PS_header[i] != NULL; i++)
- X***************
- X*** 150,156
- X fprintf(outfile,"%%%%EndProlog\n");
- X fprintf(outfile,"%%%%BeginSetup\n");
- X fprintf(outfile,"/Gnu_save save def\n");
- X! fprintf(outfile,"%.3f %.3f scale\n",PS_SC,PS_SC);
- X fprintf(outfile,"%%%%IncludeFont: %s\n", ps_font);
- X fprintf(outfile,"/%s findfont %d ", ps_font,
- X ps_big ? PS_VCHAR2 : PS_VCHAR1 );
- X
- X--- 153,160 -----
- X fprintf(outfile,"%%%%EndProlog\n");
- X fprintf(outfile,"%%%%BeginSetup\n");
- X fprintf(outfile,"/Gnu_save save def\n");
- X! fprintf(outfile,"%.3f %.3f scale\n",1.0/PS_SC,1.0/PS_SC);
- X! fprintf(outfile,"0 setgray\n");
- X fprintf(outfile,"%%%%IncludeFont: %s\n", ps_font);
- X fprintf(outfile,"/%s findfont %d ", ps_font,
- X ps_big ? PS_VCHAR2 : PS_VCHAR1 );
- X***************
- X*** 198,205
- X fprintf(outfile,"%%%%DocumentNeededFonts: %s\n", ps_font);
- X fprintf(outfile,"%%%%Pages: (atend)\n");
- X fprintf(outfile,"%%%%BoundingBox: %d 50 550 %d\n",
- X! (int)(550.5-ysize*(PS_YMAX)*PS_SC*2),
- X! (int)(50.5+xsize*(PS_XMAX)*PS_SC*2) );
- X fprintf(outfile,"%%%%EndComments\n");
- X fprintf(outfile,"/GnuTransform {\n");
- X fprintf(outfile," 90 rotate\n 50 -550 translate\n 2 2 scale\n");
- X
- X--- 202,209 -----
- X fprintf(outfile,"%%%%DocumentNeededFonts: %s\n", ps_font);
- X fprintf(outfile,"%%%%Pages: (atend)\n");
- X fprintf(outfile,"%%%%BoundingBox: %d 50 550 %d\n",
- X! (int)(550.5-ysize*(PS_YMAX)/PS_SC*2),
- X! (int)(50.5+xsize*(PS_XMAX)/PS_SC*2) );
- X fprintf(outfile,"%%%%EndComments\n");
- X fprintf(outfile,"/GnuTransform {\n");
- X fprintf(outfile," 90 rotate\n 50 -550 translate\n 2 2 scale\n");
- X***************
- X*** 292,297
- X }
- X if (ps_ang != 0)
- X fprintf(outfile,"grestore\n");
- X }
- X
- X int PS_text_angle(ang)
- X
- X--- 296,302 -----
- X }
- X if (ps_ang != 0)
- X fprintf(outfile,"grestore\n");
- X+ ps_path_count = 0;
- X }
- X
- X int PS_text_angle(ang)
- Xdiff -c ./term/t410x.trm ../patch/term/t410x.trm
- X*** ./term/t410x.trm Wed Aug 29 12:16:17 1990
- X--- ../patch/term/t410x.trm Tue Aug 28 20:28:50 1990
- X***************
- X*** 0
- X
- X--- 1,239 -----
- X+ /* GNUPLOT - t410x.trm */
- X+ /*
- X+ * Copyright (C) 1990
- X+ *
- X+ * Permission to use, copy, and distribute this software and its
- X+ * documentation for any purpose with or without fee is hereby granted,
- X+ * provided that the above copyright notice appear in all copies and
- X+ * that both that copyright notice and this permission notice appear
- X+ * in supporting documentation.
- X+ *
- X+ * Permission to modify the software is granted, but not the right to
- X+ * distribute the modified code. Modifications are to be distributed
- X+ * as patches to released version.
- X+ *
- X+ * This software is provided "as is" without express or implied warranty.
- X+ *
- X+ * This file is included by ../term.c.
- X+ *
- X+ * This terminal driver supports: Tektronix 410x and 420x series terminals
- X+ *
- X+ * AUTHORS
- X+ * Colin Kelley, Thomas Williams
- X+ *
- X+ * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- X+ *
- X+ */
- X+
- X+ /* Tektronix 410X and 420X driver written by Cary D. Renzema.
- X+ * email address: caryr@vice.ico.tek.com
- X+ *
- X+ * I've tested this driver on the following terminals: 4106, 4107A, 4109
- X+ * and 4207. It should work, without editing, on other terminals in the
- X+ * 410x and 420x families. It will probably need to be changed to work
- X+ * on a 4105 (screen size and character rotation are two guesses). This
- X+ * file can also be used as a start for a 411x driver.
- X+ *
- X+ * Cary R.
- X+ * April 5, 1990
- X+ */
- X+
- X+ #ifdef T410X
- X+
- X+ #define T410XXMAX 4095
- X+ #define T410XYMAX 3131
- X+
- X+ #define T410XVCHAR 71
- X+ #define T410XHCHAR 51
- X+ #define T410XVTIC 36
- X+ #define T410XHTIC 36
- X+
- X+ static int T410X_angle=0;
- X+
- X+ T410X_init()
- X+ {
- X+ (void) fprintf(outfile, "\033%%!0\033MN0\033MCB7C;\033MQ1\033MT1");
- X+ (void) fprintf(outfile, "\033MG1\033RK!\033SK!\033LZ\033%%!1");
- X+ /*
- X+ 1. set tek mode
- X+ 2. set character path to 0 (characters placed equal to rotation)
- X+ 3. set character size to 59 height
- X+ 4. set character precision to string
- X+ 5. set character text index to 1
- X+ 6. set character write mode to overstrike
- X+ 7. clear the view
- X+ 8. clear the segments
- X+ 9. clear the dialog buffer
- X+ 10. set ansi mode
- X+ */
- X+ (void) fflush(outfile);
- X+ }
- X+
- X+
- X+ T410X_reset()
- X+ {
- X+ (void) fprintf(outfile, "\033%%!0\033LZ\033%%!1");
- X+ /*
- X+ 1. set tek mode
- X+ 2. clear the dialog buffer
- X+ 3. set ansi mode
- X+ */
- X+ (void) fflush(outfile);
- X+ }
- X+
- X+
- X+ T410X_graphics()
- X+ {
- X+ (void) fprintf(outfile, "\033%%!0\033\014\033LV0");
- X+ /*
- X+ 1. set tek mode
- X+ 2. clear the screen
- X+ 3. set dialog area invisible
- X+ */
- X+ (void) fflush(outfile);
- X+ }
- X+
- X+ T410X_text()
- X+ {
- X+ (void) fprintf(outfile, "\033LV1\033%%!1");
- X+ /*
- X+ 1. set dialog area visible
- X+ 2. set ansi mode
- X+ */
- X+ (void) fflush(outfile);
- X+ }
- X+
- X+
- X+ T410X_move(x, y)
- X+ unsigned int x, y;
- X+ {
- X+ (void) fprintf(outfile, "\033LF");
- X+ (void) T410X_encode_x_y(x, y);
- X+ (void) fflush(outfile);
- X+ }
- X+
- X+
- X+ T410X_vector(x, y)
- X+ unsigned int x, y;
- X+ {
- X+ (void) fprintf(outfile, "\033LG");
- X+ (void) T410X_encode_x_y(x, y);
- X+ (void) fflush(outfile);
- X+ }
- X+
- X+
- X+ T410X_point(x, y, number)
- X+ unsigned int x, y;
- X+ int number;
- X+ {
- X+ (void) fprintf(outfile, "\033MM");
- X+ (void) T410X_encode_int(max(number, 0)%11);
- X+ (void) fprintf(outfile, "\033LH");
- X+ (void) T410X_encode_x_y(x, y);
- X+ (void) fflush(outfile);
- X+ }
- X+
- X+
- X+ T410X_linetype(linetype)
- X+ int linetype;
- X+ {
- X+ switch (linetype) {
- X+ case -1:
- X+ (void) fprintf(outfile, "\033ML5");
- X+ break;
- X+ case -2:
- X+ (void) fprintf(outfile, "\033ML?");
- X+ break;
- X+ default:
- X+ (void) fprintf(outfile, "\033ML");
- X+ (void) T410X_encode_int(linetype%14+2);
- X+ break;
- X+ }
- X+ (void) fprintf(outfile, "\033MV");
- X+ (void) T410X_encode_int(max(linetype, 0)%8);
- X+ (void) fflush(outfile);
- X+ }
- X+
- X+
- X+ T410X_put_text(x, y, str)
- X+ unsigned int x, y;
- X+ char str[];
- X+ {
- X+ extern int T410X_angle;
- X+
- X+ if (T410X_angle == 0) {
- X+ (void) T410X_move(x, y-T410XVCHAR/2+6);
- X+ (void) fprintf(outfile, "\033MR00");
- X+ } else {
- X+ (void) T410X_move(x+T410XHCHAR/2-6, y);
- X+ (void) fprintf(outfile, "\033MRE:0");
- X+ }
- X+ (void) fprintf(outfile, "\033LT");
- X+ (void) T410X_encode_int(strlen(str));
- X+ (void) fputs(str, outfile);
- X+ (void) fflush(outfile);
- X+ }
- X+
- X+ T410X_text_angle(ang)
- X+ int ang;
- X+ {
- X+ extern int T410X_angle;
- X+
- X+ T410X_angle = ang;
- X+ return(TRUE);
- X+ }
- X+
- X+ /* These last two routines are based on fortran code found in the
- X+ * 4106/4107/4109/CX PROGRAMMERS manual.
- X+ */
- X+
- X+ T410X_encode_x_y(x, y)
- X+ unsigned int x, y;
- X+ {
- X+ static char chix=0, chiy=0, cloy=0, ceb=0;
- X+
- X+ register unsigned int hix, lox, hiy, loy, eb, lx, ly;
- X+
- X+ lx = (x <= T410XXMAX) ? x : T410XXMAX;
- X+ ly = (y <= T410XYMAX) ? y : T410XYMAX;
- X+
- X+ hix = lx/128 + 32;
- X+ lox = (lx/4)%32 + 64;
- X+ hiy = ly/128 + 32;
- X+ loy = (ly/4)%32 + 96;
- X+ eb = (ly%4)*4 + lx%4 + 96;
- X+
- X+ if (chiy != hiy) (void) putc(hiy, outfile);
- X+ if (ceb != eb) (void) putc(eb, outfile);
- X+ if ((cloy!=loy) || (ceb!=eb) || (chix!=hix)) (void) putc(loy, outfile);
- X+ if (chix != hix) (void) putc(hix, outfile);
- X+ (void) putc(lox, outfile);
- X+
- X+ chix = hix;
- X+ chiy = hiy;
- X+ cloy = loy;
- X+ ceb = eb;
- X+ }
- X+
- X+
- X+ T410X_encode_int(number)
- X+ int number;
- X+ {
- X+ register unsigned int mag, hi1, hi2, lo;
- X+
- X+ mag = abs(number);
- X+
- X+ hi1 = mag/1024 + 64;
- X+ hi2 = (mag/16)%64 + 64;
- X+ lo = mag%16 + 32;
- X+
- X+ if (number >= 0) lo += 16;
- X+
- X+ if (hi1 != 64) (void) putc(hi1, outfile);
- X+ if ((hi2 != 64) || (hi1 != 64)) (void) putc(hi2, outfile);
- X+ (void) putc(lo, outfile);
- X+
- X+ }
- X+
- X+
- X+ #endif /* T410X */
- Xdiff -c ./term/unixpc.trm ../patch/term/unixpc.trm
- X*** ./term/unixpc.trm Tue Mar 27 09:03:15 1990
- X--- ../patch/term/unixpc.trm Tue Aug 28 16:03:19 1990
- X***************
- X*** 122,128
- X uw.uw_height = uPC_YMAX; /* 288 normal--we clobber 12 (top row)*/
- X uw.uw_uflags = 1; /* Creates with no border */
- X
- X! IfErrOut (ioctl(0, WIOCSETD, &uw), <0, "ioctl failed on", "WIOCSETD");
- X }
- X
- X
- X
- X--- 122,128 -----
- X uw.uw_height = uPC_YMAX; /* 288 normal--we clobber 12 (top row)*/
- X uw.uw_uflags = 1; /* Creates with no border */
- X
- X! IfErrOut (ioctl(1, WIOCSETD, &uw), <0, "ioctl failed on", "WIOCSETD");
- X }
- X
- X
- X***************
- X*** 144,150
- X printf ("\033[25;1H");
- X
- X uPC_ur.ur_dstop = DSTSRC; /* replace (clear screen). */
- X! IfErrOut (ioctl(0, WIOCRASTOP, &uPC_ur), <0,
- X "ioctl failed", "WIOCRASTOP");
- X uPC_ur.ur_dstop = DSTOR; /* Or in (show text) */
- X }
- X
- X--- 144,150 -----
- X printf ("\033[25;1H");
- X
- X uPC_ur.ur_dstop = DSTSRC; /* replace (clear screen). */
- X! IfErrOut (ioctl(1, WIOCRASTOP, &uPC_ur), <0,
- X "ioctl failed", "WIOCRASTOP");
- X uPC_ur.ur_dstop = DSTOR; /* Or in (show text) */
- X }
- X***************
- X*** 154,160
- X {
- X /* This routine will flush the display. */
- X
- X! IfErrOut (ioctl(0, WIOCRASTOP, &uPC_ur), <0,
- X "ioctl failed", "WIOCRASTOP");
- X }
- X
- X
- X--- 154,160 -----
- X {
- X /* This routine will flush the display. */
- X
- X! IfErrOut (ioctl(1, WIOCRASTOP, &uPC_ur), <0,
- X "ioctl failed", "WIOCRASTOP");
- X }
- X
- X***************
- X*** 522,528
- X struct utdata ut;
- X
- X /* Reset the window to the right size. */
- X! ioctl(0, WIOCSETD, &wreset); /* 0, not wncur here! */
- X
- X /* Scroll the screen once. (avoids typing over the same line) */
- X fprintf (stderr, "\n");
- X
- X--- 522,528 -----
- X struct utdata ut;
- X
- X /* Reset the window to the right size. */
- X! ioctl(1, WIOCSETD, &wreset); /* 0, not wncur here! */
- X
- X /* Scroll the screen once. (avoids typing over the same line) */
- X fprintf (stderr, "\n");
- Xdiff -c ./term/x11.trm ../patch/term/x11.trm
- X*** ./term/x11.trm Thu Sep 6 09:24:44 1990
- X--- ../patch/term/x11.trm Tue Sep 4 00:50:32 1990
- X***************
- X*** 0
- X
- X--- 1,77 -----
- X+ /*
- X+ * x11.trm --- inboard terminal driver for X11
- X+ */
- X+
- X+ #define X11_XMAX 4096
- X+ #define X11_YMAX 4096
- X+
- X+ /* approximations for typical font/screen sizes */
- X+ #define X11_VCHAR (X11_YMAX/25)
- X+ #define X11_HCHAR (X11_XMAX/100)
- X+ #define X11_VTIC (X11_YMAX/100)
- X+ #define X11_HTIC (X11_XMAX/150)
- X+
- X+ #define X11_nopts 22
- X+ char X11_opts[X11_nopts][20] = {
- X+ "-iconic", "-rv", "-reverse", "+rv", "-synchronous",
- X+ "-display", "-geometry", "-bg", "-background", "-bd", "-bordercolor", "-bw",
- X+ "-borderwidth", "-fg", "-foreground", "-fn", "-font", "-name",
- X+ "-selectionTimeout", "-title", "-xnllanguage", "-xrm"
- X+ };
- X+ int X11_optarg[X11_nopts] = {
- X+ 0, 0, 0, 0, 0,
- X+ 1, 1, 1, 1, 1, 1, 1,
- X+ 1, 1, 1, 1, 1, 1,
- X+ 1, 1, 1, 1
- X+ };
- X+
- X+ FILE *X11_pipe, *popen();
- X+ char X11_command[1024]= "gnuplot_x11 -name gnuplot";
- X+
- X+
- X+ /* X11_args - scan gnuplot command line for standard X Toolkit options */
- X+
- X+ X11_args(argc, argv) int argc; char *argv[]; {
- X+ int nx11 = 0, n;
- X+
- X+ while(++argv, --argc > 0) {
- X+ for (n=0; n<X11_nopts; n++) {
- X+ if (!strcmp(*argv, X11_opts[n])) {
- X+ strcat(X11_command, " ");
- X+ strcat(X11_command, *argv);
- X+ if (X11_optarg[n]) {
- X+ if (--argc <= 0) return(nx11);
- X+ strcat(X11_command, " \"");
- X+ strcat(X11_command, *++argv);
- X+ strcat(X11_command, "\"");
- X+ nx11++;
- X+ }
- X+ nx11++; break;
- X+ }
- X+ }
- X+ if (n == X11_nopts) break;
- X+ }
- X+ return(nx11);
- X+ }
- X+
- X+ X11_init() { X11_pipe = popen(X11_command, "w"); }
- X+
- X+ X11_reset() { fprintf(X11_pipe, "R\n"); fflush(X11_pipe); }
- X+
- X+ X11_text() { fprintf(X11_pipe, "E\n"); fflush(X11_pipe); }
- X+
- X+ X11_graphics() { fprintf(X11_pipe, "G\n"); }
- X+
- X+ X11_move(x,y) unsigned int x,y; { fprintf(X11_pipe, "M%04d%04d\n", x, y); }
- X+
- X+ X11_vector(x,y) unsigned int x,y; { fprintf(X11_pipe, "V%04d%04d\n", x, y); }
- X+
- X+ X11_linetype(lt) int lt; { fprintf(X11_pipe, "L%04d\n", lt); }
- X+
- X+ X11_put_text(x,y,str) unsigned int x,y; char str[]; {
- X+ fprintf(X11_pipe, "T%04d%04d%s\n", x, y, str);
- X+ }
- X+ X11_justify_text(mode) enum JUSTIFY mode; {
- X+ fprintf(X11_pipe, "J%04d\n", mode);
- X+ return(TRUE);
- X+ }
- X*** ./term.h Wed Aug 29 12:15:55 1990
- X--- ../patch1/term.h Tue Sep 18 14:40:02 1990
- X***************
- X*** 0
- X
- X--- 1,86 -----
- X+ /* GNUPLOT - term.h */
- X+ /*
- X+ * Copyright (C) 1986, 1987, 1990 Thomas Williams, Colin Kelley
- X+ *
- X+ * Permission to use, copy, and distribute this software and its
- X+ * documentation for any purpose with or without fee is hereby granted,
- X+ * provided that the above copyright notice appear in all copies and
- X+ * that both that copyright notice and this permission notice appear
- X+ * in supporting documentation.
- X+ *
- X+ * Permission to modify the software is granted, but not the right to
- X+ * distribute the modified code. Modifications are to be distributed
- X+ * as patches to released version.
- X+ *
- X+ * This software is provided "as is" without express or implied warranty.
- X+ *
- X+ *
- X+ * AUTHORS
- X+ *
- X+ * Original Software:
- X+ * Thomas Williams, Colin Kelley.
- X+ *
- X+ * Gnuplot 2.0 additions:
- X+ * Russell Lang, Dave Kotz, John Campbell.
- X+ *
- X+ * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- X+ *
- X+ **************************************
- X+ * term.h: terminal support definitions
- X+ * Edit this file depending on the set of terminals you wish to support.
- X+ * Comment out the terminal types that you don't want or don't have, and
- X+ * uncomment those that you want included. Be aware that some terminal
- X+ * types (eg, SUN, UNIXPLOT) will require changes in the makefile
- X+ * LIBS definition.
- X+ */
- X+
- X+ /* These terminals are not relevant for MSDOS */
- X+ #ifndef MSDOS
- X+
- X+ #define AED /* AED 512 and AED 767 */
- X+ #define BITGRAPH /* BBN BitGraph */
- X+ #define HPLJET /* HP Laserjet */
- X+ /* #define IRIS4D /* IRIS4D series computer */
- X+ #define KERMIT /* MS-Kermit Tektronix 4010 emulator */
- X+ /* #define FIG /* Fig graphics language (requires object.h from TransFig) */
- X+ #define REGIS /* ReGis graphics (vt125, vt220, vt240, Gigis...) */
- X+ #define SELANAR /* Selanar */
- X+ /* #define SUN /* Sun Microsystems Workstation */
- X+ #define T410X /* Tektronix 4106, 4107, 4109 and 420x terminals */
- X+ #define TEK /* Tektronix 4010, and probably others */
- X+ /* #define UNIXPC /* unixpc (ATT 3b1 or ATT 7300) */
- X+ /* #define UNIXPLOT /* unixplot */
- X+ /* #define X11 /* X11R4 window system */
- X+
- X+ #endif
- X+
- X+ /* These terminals can be used on any system */
- X+ #define DXY800A /* Roland DXY800A plotter */
- X+ #define EEPIC /* EEPIC-extended LaTeX driver, for EEPIC users */
- X+ #define EMTEX /* LATEX picture environment with EMTEX specials */
- X+ #define EPS60 /* Epson-style 60-dot per inch printers */
- X+ #define EPSON /* Epson LX-800, Star NL-10, NX-1000 and lots of others */
- X+ #define HP2648 /* HP2648, HP2647 */
- X+ #define HP26 /* HP2623A and maybe others */
- X+ #define HP75 /* HP7580, and probably other HPs */
- X+ #define HPGL /* HP7475, HP7220 plotters, and (hopefully) lots of others */
- X+ #define IMAGEN /* Imagen laser printers (300dpi) (requires -Iterm also) */
- X+ #define LATEX /* LATEX picture environment */
- X+ #define NEC /* NEC CP6 pinwriter printer */
- X+ #define POSTSCRIPT /* Postscript */
- X+ #define PROPRINTER /* IBM Proprinter */
- X+ #define QMS /* QMS/QUIC laserprinter (Talaris 1200 and others) */
- X+ #define STARC /* Star Color Printer */
- X+ #define TANDY60 /* Tandy DMP-130 series 60-dot per inch graphics */
- X+ #define V384 /* Vectrix 384 and tandy color printer */
- X+
- X+ /* These are for MSDOS only */
- X+ #ifdef MSDOS
- X+ #ifdef __TURBOC__
- X+ #define ATT6300 /* AT&T 6300 graphics */
- X+ #else
- X+ #define ATT6300 /* AT&T 6300 graphics */
- X+ #define CORONA /* Corona graphics 325 */
- X+ #define HERCULES /* IBM PC/Clone with Hercules graphics board */
- X+ #endif
- X+ #endif
- X*** ./term.c Tue Mar 27 09:02:05 1990
- X--- ../patch1/term.c Thu Sep 6 09:20:17 1990
- X***************
- X*** 29,34
- X
- X #include <stdio.h>
- X #include "plot.h"
- X
- X /* for use by all drivers */
- X #define sign(x) ((x) >= 0 ? 1 : -1)
- X
- X--- 29,35 -----
- X
- X #include <stdio.h>
- X #include "plot.h"
- X+ #include "term.h"
- X
- X /* for use by all drivers */
- X #define sign(x) ((x) >= 0 ? 1 : -1)
- X***************
- X*** 242,247
- X #endif
- X #endif
- X
- X #ifdef EPSON
- X #define FONT57
- X #endif
- X
- X--- 243,266 -----
- X #endif
- X #endif
- X
- X+ #ifdef STARC
- X+ #ifndef EPSON
- X+ #define EPSON
- X+ #endif
- X+ #endif
- X+
- X+ #ifdef TANDY60
- X+ #ifndef EPS60
- X+ #define EPS60
- X+ #endif
- X+ #endif
- X+
- X+ #ifdef EPS60
- X+ #ifndef EPSON
- X+ #define EPSON
- X+ #endif
- X+ #endif
- X+
- X #ifdef EPSON
- X #define FONT57
- X #endif
- X***************
- X*** 282,287
- X # endif
- X #endif
- X
- X #ifdef TEK /* all TEK types, TEK, BBN, SELANAR, KERMIT */
- X #include "term/tek.trm"
- X #endif
- X
- X--- 301,310 -----
- X # endif
- X #endif
- X
- X+ #ifdef T410X /* Tektronix 4106, 4107, 4109 and 420x terminals */
- X+ #include "term/t410x.trm"
- X+ #endif
- X+
- X #ifdef TEK /* all TEK types, TEK, BBN, SELANAR, KERMIT */
- X #include "term/tek.trm"
- X #endif
- X***************
- X*** 286,292
- X #include "term/tek.trm"
- X #endif
- X
- X! #ifdef EPSON /* all bit map types, EPSON, NEC, PROPRINTER */
- X #include "term/epson.trm"
- X #endif
- X
- X
- X--- 309,315 -----
- X #include "term/tek.trm"
- X #endif
- X
- X! #ifdef EPSON /* bit map types, EPSON, NEC, PROPRINTER, STAR Color */
- X #include "term/epson.trm"
- X #endif
- X
- X***************
- X*** 290,295
- X #include "term/epson.trm"
- X #endif
- X
- X #ifdef FIG /* Fig 1.4FS Interactive graphics program */
- X #include "term/fig.trm"
- X #endif
- X
- X--- 313,322 -----
- X #include "term/epson.trm"
- X #endif
- X
- X+ #ifdef EPS60 /* old-style EPSON 60-dpi */
- X+ #include "term/eps60.trm"
- X+ #endif
- X+
- X #ifdef FIG /* Fig 1.4FS Interactive graphics program */
- X #include "term/fig.trm"
- X #endif
- X***************
- X*** 305,310
- X # endif
- X #endif
- X
- X #ifdef LATEX /* LATEX type */
- X #include "term/latex.trm"
- X #endif
- X
- X--- 332,343 -----
- X # endif
- X #endif
- X
- X+ #ifdef EMTEX /* EMTEX (LATEX for PC) type */
- X+ # ifndef LATEX
- X+ # define LATEX
- X+ # endif
- X+ #endif
- X+
- X #ifdef LATEX /* LATEX type */
- X #include "term/latex.trm"
- X #endif
- X***************
- X*** 375,380
- X #include "term/unixplot.trm"
- X #endif /* UNIXPLOT */
- X
- X /* Dummy functions for unavailable features */
- X
- X /* change angle of text. 0 is horizontal left to right.
- X
- X--- 408,417 -----
- X #include "term/unixplot.trm"
- X #endif /* UNIXPLOT */
- X
- X+ #ifdef X11
- X+ #include "term/x11.trm"
- X+ #endif /* X11 */
- X+
- X /* Dummy functions for unavailable features */
- X
- X /* change angle of text. 0 is horizontal left to right.
- X***************
- X*** 464,469
- X HERC_text, null_scale, HERC_graphics, HERC_move, HERC_vector,
- X HERC_linetype, HERC_put_text, MCGA_text_angle,
- X HERC_justify_text, line_and_point, do_arrow}
- X #else /* TURBO */
- X
- X ,{"cga", "IBM PC/Clone with CGA graphics board",
- X
- X--- 501,514 -----
- X HERC_text, null_scale, HERC_graphics, HERC_move, HERC_vector,
- X HERC_linetype, HERC_put_text, MCGA_text_angle,
- X HERC_justify_text, line_and_point, do_arrow}
- X+ #ifdef ATT6300
- X+ ,{"att", "IBM PC/Clone with AT&T 6300 graphics board",
- X+ ATT_XMAX, ATT_YMAX, ATT_VCHAR, ATT_HCHAR,
- X+ ATT_VTIC, ATT_HTIC, ATT_init, ATT_reset,
- X+ ATT_text, null_scale, ATT_graphics, ATT_move, ATT_vector,
- X+ ATT_linetype, ATT_put_text, ATT_text_angle,
- X+ ATT_justify_text, line_and_point, do_arrow}
- X+ #endif
- X #else /* TURBO */
- X
- X ,{"cga", "IBM PC/Clone with CGA graphics board",
- X***************
- X*** 506,512
- X #endif /* HERCULES */
- X
- X #ifdef ATT6300
- X! ,{"att", "AT&T 6300 terminal ???",
- X ATT_XMAX, ATT_YMAX, ATT_VCHAR, ATT_HCHAR,
- X ATT_VTIC, ATT_HTIC, ATT_init, ATT_reset,
- X ATT_text, null_scale, ATT_graphics, ATT_move, ATT_vector,
- X
- X--- 551,557 -----
- X #endif /* HERCULES */
- X
- X #ifdef ATT6300
- X! ,{"att", "AT&T PC/6300 graphics",
- X ATT_XMAX, ATT_YMAX, ATT_VCHAR, ATT_HCHAR,
- X ATT_VTIC, ATT_HTIC, ATT_init, ATT_reset,
- X ATT_text, null_scale, ATT_graphics, ATT_move, ATT_vector,
- X***************
- X*** 558,563
- X null_justify_text, do_point, do_arrow}
- X #endif
- X
- X #ifdef EPSON
- X ,{"epson_lx800", "Epson LX-800, Star NL-10, NX-1000 and lots of others",
- X EPSONXMAX, EPSONYMAX, EPSONVCHAR, EPSONHCHAR,
- X
- X--- 603,636 -----
- X null_justify_text, do_point, do_arrow}
- X #endif
- X
- X+ #ifdef EEPIC
- X+ ,{"eepic", "EEPIC -- extended LaTeX picture environment",
- X+ EEPIC_XMAX, EEPIC_YMAX, EEPIC_VCHAR, EEPIC_HCHAR,
- X+ EEPIC_VTIC, EEPIC_HTIC, EEPIC_init, EEPIC_reset,
- X+ EEPIC_text, EEPIC_scale, EEPIC_graphics, EEPIC_move, EEPIC_vector,
- X+ EEPIC_linetype, EEPIC_put_text, EEPIC_text_angle,
- X+ EEPIC_justify_text, EEPIC_point, EEPIC_arrow}
- X+ #endif
- X+
- X+ #ifdef EMTEX
- X+
- X+ ,{"emtex", "LATEX picture environment with emTeX specials",
- X+ LATEX_XMAX, LATEX_YMAX, LATEX_VCHAR, LATEX_HCHAR,
- X+ LATEX_VTIC, LATEX_HTIC, EMTEX_init, EMTEX_reset,
- X+ EMTEX_text, LATEX_scale, LATEX_graphics, LATEX_move, LATEX_vector,
- X+ LATEX_linetype, LATEX_put_text, LATEX_text_angle,
- X+ LATEX_justify_text, LATEX_point, LATEX_arrow}
- X+ #endif
- X+
- X+ #ifdef EPS60
- X+ ,{"epson_60dpi", "Epson-style 60-dot per inch printers",
- X+ EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
- X+ EPSONVTIC, EPSONHTIC, EPS60init, EPSONreset,
- X+ EPS60text, null_scale, EPSONgraphics, EPSONmove, EPSONvector,
- X+ EPSONlinetype, EPSONput_text, EPSON_text_angle,
- X+ null_justify_text, do_point, do_arrow}
- X+ #endif
- X+
- X #ifdef EPSON
- X ,{"epson_lx800", "Epson LX-800, Star NL-10, NX-1000 and lots of others",
- X EPSONXMAX, EPSONYMAX, EPSONVCHAR, EPSONHCHAR,
- X***************
- X*** 675,689
- X LATEX_justify_text, LATEX_point, LATEX_arrow}
- X #endif
- X
- X- #ifdef EEPIC
- X- ,{"eepic", "EEPIC -- extended LaTeX picture environment",
- X- EEPIC_XMAX, EEPIC_YMAX, EEPIC_VCHAR, EEPIC_HCHAR,
- X- EEPIC_VTIC, EEPIC_HTIC, EEPIC_init, EEPIC_reset,
- X- EEPIC_text, EEPIC_scale, EEPIC_graphics, EEPIC_move, EEPIC_vector,
- X- EEPIC_linetype, EEPIC_put_text, EEPIC_text_angle,
- X- EEPIC_justify_text, EEPIC_point, EEPIC_arrow}
- X- #endif
- X-
- X #ifdef NEC
- X ,{"nec_cp6m", "NEC printer CP6 Monochrome",
- X NECXMAX, NECYMAX, NECVCHAR, NECHCHAR,
- X
- X--- 748,753 -----
- X LATEX_justify_text, LATEX_point, LATEX_arrow}
- X #endif
- X
- X #ifdef NEC
- X ,{"nec_cp6m", "NEC printer CP6 Monochrome",
- X NECXMAX, NECYMAX, NECVCHAR, NECHCHAR,
- X***************
- X*** 769,774
- X null_justify_text, line_and_point, do_arrow}
- X #endif
- X
- X #ifdef SUN
- X ,{"sun", "SunView window system",
- X SUN_XMAX, SUN_YMAX, SUN_VCHAR, SUN_HCHAR,
- X
- X--- 833,847 -----
- X null_justify_text, line_and_point, do_arrow}
- X #endif
- X
- X+ #ifdef STARC
- X+ ,{"starc", "Star Color Printer",
- X+ STARCXMAX, STARCYMAX, STARCVCHAR, STARCHCHAR,
- X+ STARCVTIC, STARCHTIC, STARCinit, STARCreset,
- X+ STARCtext, null_scale, STARCgraphics, STARCmove, STARCvector,
- X+ STARClinetype, STARCput_text, STARC_text_angle,
- X+ null_justify_text, line_and_point, do_arrow}
- X+ #endif
- X+
- X #ifdef SUN
- X ,{"sun", "SunView window system",
- X SUN_XMAX, SUN_YMAX, SUN_VCHAR, SUN_HCHAR,
- X***************
- X*** 778,783
- X SUN_justify_text, line_and_point, do_arrow}
- X #endif
- X
- X #ifdef TEK
- X ,{"tek40xx", "Tektronix 4010 and others; most TEK emulators",
- X TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR,
- X
- X--- 851,874 -----
- X SUN_justify_text, line_and_point, do_arrow}
- X #endif
- X
- X+ #ifdef TANDY60
- X+ ,{"tandy_60dpi", "Tandy DMP-130 series 60-dot per inch graphics",
- X+ EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
- X+ EPSONVTIC, EPSONHTIC, EPS60init, EPSONreset,
- X+ TANDY60text, null_scale, EPSONgraphics, EPSONmove, EPSONvector,
- X+ EPSONlinetype, EPSONput_text, EPSON_text_angle,
- X+ null_justify_text, do_point, do_arrow}
- X+ #endif
- X+
- X+ #ifdef T410X
- X+ ,{"tek410x", "Tektronix 4106, 4107, 4109 and 420X terminals",
- X+ T410XXMAX, T410XYMAX, T410XVCHAR, T410XHCHAR,
- X+ T410XVTIC, T410XHTIC, T410X_init, T410X_reset,
- X+ T410X_text, null_scale, T410X_graphics, T410X_move, T410X_vector,
- X+ T410X_linetype, T410X_put_text, T410X_text_angle,
- X+ null_justify_text, T410X_point, do_arrow}
- X+ #endif
- X+
- X #ifdef TEK
- X ,{"tek40xx", "Tektronix 4010 and others; most TEK emulators",
- X TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR,
- X***************
- X*** 813,818
- X V384_linetype, V384_put_text, null_text_angle,
- X null_justify_text, do_point, do_arrow}
- X #endif
- X };
- X
- X #define TERMCOUNT (sizeof(term_tbl)/sizeof(struct termentry))
- X
- X--- 904,924 -----
- X V384_linetype, V384_put_text, null_text_angle,
- X null_justify_text, do_point, do_arrow}
- X #endif
- X+
- X+ #ifdef X11
- X+ ,{"x11", "X11 Window System",
- X+ X11_XMAX, X11_YMAX, X11_VCHAR, X11_HCHAR,
- X+ X11_VTIC, X11_HTIC, X11_init, X11_reset,
- X+ X11_text, null_scale, X11_graphics, X11_move, X11_vector,
- X+ X11_linetype, X11_put_text, null_text_angle,
- X+ X11_justify_text, line_and_point, do_arrow}
- X+ ,{"X11", "X11 Window System - multi-color points",
- X+ X11_XMAX, X11_YMAX, X11_VCHAR, X11_HCHAR,
- X+ X11_VTIC, X11_HTIC, X11_init, X11_reset,
- X+ X11_text, null_scale, X11_graphics, X11_move, X11_vector,
- X+ X11_linetype, X11_put_text, null_text_angle,
- X+ X11_justify_text, do_point, do_arrow}
- X+ #endif
- X };
- X
- X #define TERMCOUNT (sizeof(term_tbl)/sizeof(struct termentry))
- X***************
- X*** 985,990
- X case 4 : term_name = "egalib";
- X break;
- X case 7 : term_name = "hercules";
- X break;
- X case 9 : term_name = "vgalib";
- X break;
- X
- X--- 1091,1098 -----
- X case 4 : term_name = "egalib";
- X break;
- X case 7 : term_name = "hercules";
- X+ break;
- X+ case 8 : term_name = "att";
- X break;
- X case 9 : term_name = "vgalib";
- X break;
- X*** ./gnuplot_x11.c Thu Sep 6 09:22:16 1990
- X--- ../patch1/gnuplot_x11.c Wed Sep 5 21:25:26 1990
- X***************
- X*** 0
- X
- X--- 1,241 -----
- X+ /*-----------------------------------------------------------------------------
- X+ *
- X+ * gnuplot_x11 - X11 outboard terminal driver for gnuplot 2
- X+ *
- X+ * Requires installation of companion inboard x11 driver in gnuplot/term.c
- X+ *
- X+ * Acknowledgements:
- X+ * Chris Peterson (MIT) - original Xlib gnuplot support (and Xaw examples)
- X+ * Dana Chee (Bellcore) - mods to original support for gnuplot 2.0
- X+ * Arthur Smith (Cornell) - graphical-label-widget idea (xplot)
- X+ *
- X+ * This code is provided as is and with no warranties of any kind.
- X+ *
- X+ * Ed Kubaitis
- X+ * Computing Services Office - University of Illinois, Urbana
- X+ *---------------------------------------------------------------------------*/
- X+
- X+ #include <stdio.h>
- X+ #include <X11/Intrinsic.h>
- X+ #include <X11/StringDefs.h>
- X+ #include <Cardinals.h> /* use -Idir for location on your system */
- X+ #include <Label.h> /* use -Idir for location on your system */
- X+
- X+
- X+ #define Color (D>1)
- X+ #define Ncolors 11
- X+ unsigned long colors[Ncolors];
- X+ char color_keys[Ncolors][30] = { "text", "border", "axis",
- X+ "line1", "line2", "line3", "line4", "line5", "line6", "line7", "line8" };
- X+
- X+ char color_values[Ncolors][30] = { "black", "black", "black",
- X+ "red", "green", "blue", "magenta", "cyan", "sienna", "orange", "coral" };
- X+
- X+ char dashes[10][5] = { {0}, {1,6,0},
- X+ {0}, {4,2,0}, {1,3,0}, {4,4,0}, {1,5,0}, {4,4,4,1,0}, {4,2,0}, {1,3,0}
- X+ };
- X+
- X+ Widget w_top, w_label;
- X+ Window win; Display *dpy;
- X+ Pixmap pixmap; GC gc = (GC)NULL;
- X+ XFontStruct *font;
- X+ unsigned long fg, bg;
- X+ Dimension W = 640 , H = 450; int D;
- X+ Arg args[5];
- X+ static void gnuplot(), resize();
- X+
- X+ int cx=0, cy=0, vchar, nc = 0;
- X+ double xscale, yscale;
- X+ #define X(x) (Dimension) (x * xscale)
- X+ #define Y(y) (Dimension) ((4095-y) * yscale)
- X+ enum JUSTIFY { LEFT, CENTRE, RIGHT } jmode;
- X+ #define Nbuf 1024
- X+ char buf[Nbuf];
- X+ String *commands = NULL;
- X+
- X+ /*-----------------------------------------------------------------------------
- X+ * main program - fire up application and callbacks
- X+ *---------------------------------------------------------------------------*/
- X+
- X+ main(argc, argv) int argc; char *argv[]; {
- X+
- X+ /* initialize application */
- X+ w_top = XtInitialize("gnuplot", "Gnuplot", NULL, 0, &argc, argv);
- X+ XtSetArg(args[0], XtNwidth, W);
- X+ XtSetArg(args[1], XtNheight, H);
- X+ w_label = XtCreateManagedWidget("", labelWidgetClass, w_top, args, TWO);
- X+ XtRealizeWidget(w_top);
- X+
- X+ /* extract needed information */
- X+ dpy = XtDisplay(w_top); win = XtWindow(w_top); D = DisplayPlanes(dpy,0);
- X+ if (Color) {
- X+ char option[20], *value;
- X+ XColor used, exact;
- X+ int n;
- X+
- X+ for(n=0; n<Ncolors; n++) {
- X+ strcpy(option, color_keys[n]);
- X+ strcat(option, "Color");
- X+ value = XGetDefault(dpy, "gnuplot", option);
- X+ if (!value) { value = color_values[n]; }
- X+ if (XAllocNamedColor(dpy, DefaultColormap(dpy,0), value, &used,&exact))
- X+ colors[n] = used.pixel;
- X+ else {
- X+ fprintf(stderr, "gnuplot: cannot allocate %s:%s\n", option, value);
- X+ fprintf(stderr, "gnuplot: assuming %s:black\n", option);
- X+ colors[n] = BlackPixel(dpy,0);
- X+ }
- X+ }
- X+ }
- X+ XtSetArg(args[0], XtNfont, &font);
- X+ XtSetArg(args[1], XtNforeground, &fg);
- X+ XtSetArg(args[2], XtNbackground, &bg);
- X+ XtSetArg(args[3], XtNwidth, &W);
- X+ XtSetArg(args[4], XtNheight,&H);
- X+ XtGetValues(w_label, args, FIVE);
- X+ vchar = (font->ascent + font->descent);
- X+
- X+ /* add callbacks on input-from-gnuplot-on-stdin & window-resized */
- X+ XtAddInput(0, XtInputReadMask, gnuplot, NULL);
- X+ XtAddEventHandler(w_label, StructureNotifyMask, FALSE, resize, NULL);
- X+
- X+ XtMainLoop();
- X+ }
- X+
- X+ /*-----------------------------------------------------------------------------
- X+ * display - display accumulated commands from inboard driver
- X+ *---------------------------------------------------------------------------*/
- X+
- X+ display() {
- X+ int n, x, y, sw, sl, lt, width, type;
- X+ char *buf, *str;
- X+
- X+ /* set scaling factor between internal driver & window geometry */
- X+ xscale = (double)W / 4096.; yscale = (double)H / 4096.;
- X+
- X+ /* return old pixmap & GC, if any */
- X+ if (gc) { XFreeGC(dpy, gc); XFreePixmap(dpy, pixmap); }
- X+
- X+ /* create new pixmap & GC */
- X+ pixmap = XCreatePixmap(dpy, DefaultRootWindow(dpy), W, H, D);
- X+ gc = XCreateGC(dpy, pixmap, 0, NULL);
- X+ XSetFont(dpy, gc, font->fid);
- X+
- X+ /* connect new pixmap to label widget */
- X+ XtSetArg(args[0], XtNbitmap, pixmap);
- X+ XtSetValues(w_label, args, ONE);
- X+
- X+ /* erase pixmap */
- X+ if (Color) {
- X+ XSetForeground(dpy, gc, bg);
- X+ XFillRectangle(dpy, pixmap, gc, 0, 0, W, H);
- X+ XSetForeground(dpy, gc, fg);
- X+ XSetBackground(dpy, gc, bg);
- X+ }
- X+ else {
- X+ XSetFunction(dpy, gc, GXxor);
- X+ XCopyArea(dpy, pixmap, pixmap, gc, 0, 0, W, H, 0, 0);
- X+ XSetFunction(dpy, gc, GXcopyInverted);
- X+ }
- X+
- X+ /* loop over accumulated commands from inboard driver */
- X+ for (n=0; n<nc; n++) {
- X+ buf = commands[n];
- X+
- X+ /* X11_vector(x,y) - draw vector */
- X+ if (*buf == 'V') {
- X+ sscanf(buf, "V%4d%4d", &x, &y);
- X+ XDrawLine(dpy, pixmap, gc, X(cx), Y(cy), X(x), Y(y));
- X+ cx = x; cy = y;
- X+ }
- X+
- X+ /* X11_move(x,y) - move */
- X+ else if (*buf == 'M')
- X+ sscanf(buf, "M%4d%4d", &cx, &cy);
- X+
- X+ /* X11_put_text(x,y,str) - draw text */
- X+ else if (*buf == 'T') {
- X+ sscanf(buf, "T%4d%4d", &x, &y);
- X+ str = buf + 9; sl = strlen(str) - 1;
- X+ sw = XTextWidth(font, str, sl);
- X+ switch(jmode) {
- X+ case LEFT: sw = 0; break;
- X+ case CENTRE: sw = -sw/2; break;
- X+ case RIGHT: sw = -sw; break;
- X+ }
- X+ if (!Color)
- X+ XDrawString(dpy, pixmap, gc, X(x)+sw, Y(y)+vchar/3, str, sl);
- X+ else {
- X+ XSetForeground(dpy, gc, colors[0]);
- X+ XDrawString(dpy, pixmap, gc, X(x)+sw, Y(y)+vchar/3, str, sl);
- X+ XSetForeground(dpy, gc, colors[lt+1]);
- X+ }
- X+ }
- X+
- X+ /* X11_justify_text(mode) - set text justification mode */
- X+ else if (*buf == 'J')
- X+ sscanf(buf, "J%4d", &jmode);
- X+
- X+ /* X11_linetype(type) - set line type */
- X+ else if (*buf == 'L') {
- X+ sscanf(buf, "L%4d", <);
- X+ lt = (lt+2)%10;
- X+ width = (lt == 0) ? 2 : 0;
- X+ if (Color) {
- X+ if (lt != 1)
- X+ type = LineSolid;
- X+ else {
- X+ type = LineOnOffDash;
- X+ XSetDashes(dpy, gc, 0, dashes[lt], strlen(dashes[lt]));
- X+ }
- X+ XSetForeground(dpy, gc, colors[lt+1]);
- X+ }
- X+ else {
- X+ type = (lt == 0 || lt == 2) ? LineSolid : LineOnOffDash;
- X+ if (dashes[lt][0])
- X+ XSetDashes(dpy, gc, 0, dashes[lt], strlen(dashes[lt]));
- X+ }
- X+ XSetLineAttributes( dpy,gc, width, type, CapButt, JoinBevel);
- X+ }
- X+ }
- X+
- X+ /* trigger expose events to display pixmap */
- X+ XClearArea(dpy, win, 0, 0, 0, 0, True);
- X+ }
- X+
- X+ /*-----------------------------------------------------------------------------
- X+ * gnuplot - Xt callback on input from gnuplot inboard X11 driver
- X+ *---------------------------------------------------------------------------*/
- X+
- X+ static void
- X+ gnuplot(cd, s, id) char *cd; int *s; XtInputId *id; {
- X+
- X+ while (fgets(buf, Nbuf, stdin)) {
- X+ if (*buf == 'G') { /* enter graphics mode */
- X+ if (commands) {
- X+ int n;
- X+ for (n=0; n<nc; n++) XtFree(commands[n]);
- X+ XtFree(commands);
- X+ }
- X+ commands = NULL; nc = 0;
- X+ }
- X+ else if (*buf == 'E') { display(); break; } /* leave graphics mode */
- X+ else if (*buf == 'R') { exit(0); } /* leave X11/x11 mode */
- X+ else {
- X+ commands = (String *)XtRealloc(commands, (nc+1) * sizeof(String));
- X+ commands[nc++] = XtNewString(buf);
- X+ }
- X+ }
- X+ if (feof(stdin) || ferror(stdin)) exit(0);
- X+ }
- X+
- X+ /*-----------------------------------------------------------------------------
- X+ * resize - Xt callback when window resized
- X+ *---------------------------------------------------------------------------*/
- X+
- X+ static void
- X+ resize(w, cd, e) Widget w; char *cd; XConfigureEvent *e; {
- X+ if (e->type != ConfigureNotify) return;
- X+ W = e->width; H = e->height;
- X+ display();
- X+ }
- END_OF_patch1c
- if test 73914 -ne `wc -c <patch1c`; then
- echo shar: \"patch1c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- echo shar: End of shell archive.
- exit 0
-
-